home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / terms / kermit / b / ik0pro.asm < prev    next >
Encoding:
Assembly Source File  |  1992-09-29  |  193.7 KB  |  2,450 lines

  1. *COPY                                                 IK0PRO            07000000
  2.          CHECKVER IK0PRO,4.2                                   @SC90072 07000500
  3.          TITLE 'SERVER Routine - performs Server mode functions'        07001000
  4. * Exit: ERRNUM set appropriately.                                       07001500
  5. SERVER   ENTER                                                          07002000
  6.          LA    0,SRVKFIN                                       @SC86295 07003000
  7.          L     1,=A(SRVKCMD)                                   @SC87012 07004000
  8.          BAL   14,LOOPS      Set up command loop               @SC86295 07005000
  9.          KCALL INTINI,1,E=SRVXIT Initialize for server         @SC87300 07006000
  10.          OI    FL2,SRV               Server is on                       07007000
  11.          MVI   ERRNUM,ERRNOE No errors yet                     @SC86156 07008000
  12.          BAL   8,SRVLUP      Set state table                   @SC86135 07009000
  13. * Server mode Rpack interpret input table                      @SC86135 07010000
  14.          DC    AL1(AS),AL3(SRVREC)  Micro wants to send a file @SC86135 07011000
  15.          DC    AL1(AC),AL3(SRVHST)  A host command             @SC86171 07012000
  16.          DC    AL1(AI),AL3(0)       Micro sent parms           @SC86135 07013000
  17.          DC    AL1(AG),AL3(SRVGEN)  A generic command          @SC86135 07014000
  18.          DC    AL1(AK),AL3(SRVKRM)  A KERMIT command           @SC86158 07015000
  19.          DC    AL1(AR),AL3(SRVSND)  Micro wants to get a file  @SC86135 07016000
  20.          DC    XL1'FF',AL3(SRVSTP)  Stop                       @SC88074 07016500
  21.          DC    AL1(00),AL3(SRVILL)  Error routine              @SC86355 07017000
  22. SRVLUP   MVI   SEQ,0         Reset packet number               @SC86135 07018000
  23.          TM    FL3,ZPRO      Must stop?                        @SC88074 07018300
  24.          BO    SRVXIT        Yes, return immediately           @SC88074 07018600
  25.          OI    FL5,NAK0      Resend NAK during retry           @SC90037 07019000
  26.          MVC   SRVTIM,TIMOUT Save time-out limit               @SC86355 07020000
  27.          MVC   TIMOUT,TIMOSRV Set for server mode              @SC90045 07021000
  28.          MVC   LIMTRY,F5     Error loop 5 times for command    @SC86355 07022000
  29.          MVC   OLDERR,ERRNUM Save for STATUS                   @SC86158 07023000
  30.          BAL   9,INPUT       Read a packet and interpret       @SC86295 07024000
  31.          MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07025000
  32.          KCALL SPARSET       Set up for exchange               @SC86152 07026000
  33.          KCALL SPAR          Interpret I packet from other              07027000
  34.          KCALL RPAR          Reply to the I packet                      07028000
  35.          BAL   2,SENDACKL            Send an ACK, length set            07029000
  36.          MVC   ERRNUM(2),OLDERR Restore previous error code    @SC90059 07030000
  37.          B     SRVLUP        Loop again no matter what                  07031000
  38. *                                                                       07032000
  39. SRVREC   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07033000
  40.          XC    SCANPTR,SCANPTR                                 @SC86295 07034000
  41.          LA    0,FFRCF                                         @SC86295 07035000
  42.          KCALL FSPEC,FILNAM  Get filespec                      @SC86295 07036000
  43.          KCALL INTINI,3,E=SRVXIT                               @SC87300 07037000
  44.          KCALL RECEIV        Get the file                               07038000
  45.          B     SRVLUP                End of file protocol               07039000
  46. *                                                                       07040000
  47. SRVSND   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07041000
  48.          BAL   9,DECODEN     Decode the file name              @SC86295 07042000
  49.          ICM   0,B'1111',WBUFL       decoded name length                07043000
  50.          BNP   SRVMOP                                          @SC88323 07044000
  51.          L     1,WBUF                Decoded data                       07045000
  52. SRVSNT   STM   0,1,SCANPTR                                     @SC86295 07046000
  53.          LA    0,FFSND                                         @SC86295 07047000
  54.          KCALL FSPEC,IFILE,E=SRVERP   Get filespec             @SC86295 07048000
  55.          XC    SCANPTR,SCANPTR                                 @SC86295 07049000
  56.          LA    0,FFSND+FFRCF                                   @SC86295 07050000
  57.          KCALL FSPEC,JFSPEC,E=SRVERP  Get filespec             @SC86295 07051000
  58. SRVSNC   MVC   MSNDPTR,MSNDBUF No extra files                  @SC88306 07052000
  59.          KCALL SEND                                            @SC88306 07052500
  60.          B     SRVLUP                Go around again                    07053000
  61. *                                                                       07054000
  62. SRVGEN   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07055000
  63.          BAL   9,DECODEN     Decode the command                @SC86295 07056000
  64.          ICM   0,15,WBUFL    Decoded command length            @SC86158 07057000
  65.          BNP   SRVMOP                                          @SC88323 07058000
  66.          MVI   ERRNUM,ERRNOE OK so far                         @SC86171 07059000
  67.          BCTR  0,0           Remove command from data length   @SC86158 07060000
  68.          L     1,WBUF        Decoded data                      @SC86158 07061000
  69.          IC    4,0(1)                                          @SC86158 07062000
  70.          BAL   2,CLKP        Dispatch on command               @SC86158 07063000
  71.          DC    AL1(AC),AL3(SRVCWD)  cwd                        @SC86158 07064000
  72.          DC    AL1(AD),AL3(SRVDIR)  directory                  @SC86158 07065000
  73.          DC    AL1(AE),AL3(SRVDEL)  erase                      @SC86158 07066000
  74.          DC    AL1(AF),AL3(SRVFIN)  finish                     @SC86158 07067000
  75.          DC    AL1(AH),AL3(SRVHLP)  help                       @SC86158 07068000
  76.          DC    AL1(AK),AL3(SRVCPY)  copy                       @SC86158 07069000
  77.          DC    AL1(AL),AL3(SRVFIN)  bye                        @SC86158 07070000
  78.          DC    AL1(AR),AL3(SRVREN)  rename                     @SC86158 07071000
  79.          DC    AL1(AT),AL3(SRVTYP)  type                       @SC86158 07072000
  80.          DC    AL1(AU),AL3(SRVQDS)  space                      @SC86158 07073000
  81.          DC    AL1(00),AL3(SRVERS)  Unknown command            @SC86158 07074000
  82. *                                                                       07075000
  83. SRVILL   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07076000
  84. SRVERS   MVI   ERRNUM,ERRUSC Unknown Server command            @SC86156 07077000
  85. SRVERP   KCALL SUPFNC,5                                        @SC86158 07078000
  86.          KCALL ERPACK        Send an error packet              @SC86158 07079000
  87.          L     0,IOERC       I/O error count                   @SC86158 07080000
  88.          CL    0,F5          Lots of consecutive errors?       @SC86158 07081000
  89.          BL    SRVLUP        Not yet, OK                       @SC86158 07082000
  90.          B     SRVXIT        Yes, give up now                  @SC86158 07083000
  91. *                                                                       07084000
  92. SRVMOP   MVI   ERRNUM,ERRMOP Missing operand                   @SC88323 07085000
  93.          B     SRVERP                                          @SC86158 07086000
  94. *                                                                       07087000
  95. SRVHST   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07088000
  96.          BAL   9,DECODEN     Get command for host              @SC86171 07089000
  97.          BAL   9,SRVGPRW     To EBCDIC, start interception     @SC86295 07090000
  98.          B     LUPHST        Do it                             @SC86295 07091000
  99. *                                                                       07092000
  100. SRVKRM   MVC   TIMOUT,SRVTIM Restore timeout setting           @SC86355 07093000
  101.          BAL   9,DECODEN     Get command for Kermit            @SC86295 07094000
  102.          BAL   9,SRVGPRW     To EBCDIC, start interception     @SC86295 07095000
  103.          B     LUPTOK        Parse command                     @SC87012 07096000
  104. *                                                                       07097000
  105. SRVKF0   MVI   ERRNUM,ERRNOE No errors                         @SC86295 07098000
  106. SRVKFIN  MVC   OLDERR,ERRNUM Save error code                   @SC86295 07099000
  107.          KCALL SUPFNC,2      Clean up after interception       @SC86295 07100000
  108. SRVKFTX  LM    4,5,TXTPTR                                      @SC86158 07101000
  109.          SR    5,4           Any?                              @SC86158 07102000
  110.          LA    2,SRVLUP      Return adr                        @SC86158 07103000
  111.          BNP   SENDACK       No, just ACK command              @SC86158 07104000
  112.          LA    3,1023(5)     Round up                          @SC86158 07105000
  113.          SRA   3,10          Convert to kbytes                 @SC86158 07106000
  114.          ST    3,KBYTES                                        @SC86158 07107000
  115.          OI    FL4,SFM+TXT                                     @SC86158 07108000
  116.          MVC   MSNDPTR,MSNDBUF No extra files                  @SC88306 07108500
  117.          KCALL SEND          Send all                          @SC86158 07109000
  118.          CLI   ERRNUM,ERRNOE Problem with SEND?                @SC86295 07110000
  119.          BNE   SRVLUP        Yes, remember that                @SC86295 07111000
  120.          MVC   ERRNUM(2),OLDERR No, use code from commands     @SC90033 07112000
  121.          B     SRVLUP        Get another command               @SC86158 07113000
  122. *                                                                       07114000
  123. SRVTYP   OI    FL4,TXT       Send disk file to remote display  @SC86158 07115000
  124.          BAL   9,SRVGSTR     Get file-spec                     @SC86295 07116000
  125.           B    SRVMOP        None, error                       @SC88323 07117000
  126.          B     SRVSNT                                          @SC86158 07118000
  127. *                                                                       07119000
  128. *        Send remote help message to other system              @SC86158 07120000
  129. SRVHLP   LA    4,RMHTXT      Where to copy HELP TEXT from      @SC86158 07121000
  130.          LA    5,RMHTXTZ     End of text                       @SC86158 07122000
  131.          STM   4,5,TXTPTR                                      @SC86158 07123000
  132.          B     SRVKFTX                                         @SC86158 07124000
  133. *                                                                       07125000
  134. SRVDIR   BAL   3,SRVUTL                                        @SC86295 07126000
  135.          DC    AL1(13,4+1)   Wild matches                      @SC86295 07127000
  136. *                                                                       07128000
  137. SRVDEL   BAL   3,SRVUTL                                        @SC86295 07129000
  138.          DC    AL1(14,0+1)   No wild matches                   @SC86295 07130000
  139. *                                                                       07131000
  140. SRVREN   BAL   3,SRVUTL                                        @SC86295 07132000
  141.          DC    AL1(15,4+2)   Wild matches                      @SC86295 07133000
  142. *                                                                       07134000
  143. SRVCPY   BAL   3,SRVUTL                                        @SC86295 07135000
  144.          DC    AL1(16,0+2)   No wild matches                   @SC86295 07136000
  145. *                                                                       07137000
  146. SRVCWD   BAL   9,SRVGSTR     Get operand                       @SC86295 07138000
  147.           B    SRVMOP                                          @SC88323 07139000
  148.          BAL   9,SRVGPRM     Convert to plist                  @SC86295 07140000
  149.          MVI   ERRNUM,ERRFNF In case of error                  @SC86158 07141000
  150.          KCALL CWDSET,E=SRVERP                                 @SC86158 07142000
  151.          B     SRVKF0        No errors                         @SC86295 07143000
  152. *                                                                       07144000
  153. SRVQDS   BAL   9,SRVGSTR     Extract letter                    @SC86295 07145000
  154.           LA   0,0           None, use default                 @SC86158 07146000
  155.          BAL   9,SRVGPRM                                       @SC86295 07147000
  156.          B     LUPSPA                                          @SC86295 07148000
  157. * Generate command PLIST: R3-> parms                           @SC86158 07149000
  158. SRVUTL   LA    2,FILNAM      1st or only filespec              @SC86295 07150000
  159.          LH    4,0(3)                                          @SC86295 07151000
  160.          N     4,F3          Get number of names               @SC86295 07152000
  161. SRVUTLP  XC    SCANPTR,SCANPTR                                 @SC86295 07153000
  162.          BAL   9,SRVGSTR     Extract file-spec                 @SC86295 07154000
  163.           B    SRVUT1        None, check if wildcard allowed   @SC86158 07155000
  164.          STM   0,1,SCANPTR                                     @SC86295 07156000
  165. SRVUT1   LA    0,FFUTL                                         @SC86295 07157000
  166.          TM    1(3),4        Test flag                         @SC86295 07158000
  167.          BZ    *+8                                             @SC86295 07159000
  168.          LA    0,FFUTL+FFWLD Wild match if part omitted        @SC86295 07160000
  169.          KCALL FSPEC,(2),E=SRVERP  Get filespec into command   @SC86295 07161000
  170.          LR    0,6           Length remaining                  @SC86158 07162000
  171.          LR    1,7           Next field                        @SC86158 07163000
  172.          LA    2,IFILE       2nd ptr                           @SC86158 07164000
  173.          BCT   4,SRVUTLP     Loop over file-specs              @SC86158 07165000
  174.          KCALL SUPFNC,1      Start interception                @SC86158 07166000
  175.          CLC   0(1,3),SRVDIR+4                                 @SC86158 07167000
  176.          BE    SRVUT6        Don't issue STATE if DIR cmd      @SC86158 07168000
  177.          MVI   ERRNUM,ERRFNF Assume not found                  @SC86158 07169000
  178.          OPENF T,FILNAM,E=SRVERP                               @SC86295 07170000
  179. SRVUT6   LA    1,FILNAM      1st or only filespec              @SC86295 07171000
  180.          LA    2,IFILE       Possible 2nd                      @SC86295 07172000
  181.          XR    0,0                                             @SC86295 07173000
  182.          IC    0,0(3)                                          @SC86295 07174000
  183.          KCALL DISKIO                                          @SC86295 07175000
  184.          CLI   ERRNUM,ERRNOE Problem?                          @SC86295 07176000
  185.          BNE   SRVERP        Yes, too bad                      @SC86295 07177000
  186.          B     SRVKFIN                                         @SC86295 07178000
  187. * Get substring from Generic command                           @SC86158 07179000
  188. * R0= no. of chars left in packet excluding substr count byte  @SC86158 07180000
  189. * R1-> one before count byte                                   @SC86158 07181000
  190. SRVGSTR  MVI   ERRNUM,ERRIPS Assume missing operand            @SC88323 07182000
  191.          BCTR  0,0           Remove operand length field       @SC86158 07183000
  192.          LA    7,1(1)        ditto                             @SC86158 07184000
  193.          LTR   6,0           If no operands                    @SC86158 07185000
  194.          BNPR  9              then return error                @SC86295 07186000
  195.          UNCHR 0,1(1)        Operand size                      @SC86158 07187000
  196.          BZR   9             Error if zero length field        @SC86295 07188000
  197.          BM    SRVERP        Really bad                        @SC88323 07189000
  198.          LA    1,2(1)        Location of operand               @SC86158 07190000
  199.          AR    7,0           Get ptr to next field             @SC86158 07191000
  200.          SR    6,0           Length remaining                  @SC86158 07192000
  201.          BM    SRVERP        Inconsistant                      @SC88323 07193000
  202.          B     4(9)                                            @SC86295 07194000
  203. * Set up copy                                                           07195000
  204. SRVGPRW  ICM   0,15,WBUFL                                      @SC86171 07196000
  205.          BNP   SRVMOP        No text                           @SC88323 07197000
  206.          L     1,WBUF        Ptr to text                       @SC86171 07198000
  207. * Copy parameter at (R1), length in R0 and set up interception @SC86158 07199000
  208. SRVGPRM  LTR   15,0          Any chars?                        @SC86171 07200000
  209.          BNP   SRVGPS        No                                @SC86171 07201000
  210.          BCTR  15,0          Yes, translate                    @SC86171 07202000
  211.          EX    15,TRATOE                                       @SC86171 07203000
  212.          EX    15,TRUPCAS                                      @SC86171 07204000
  213. SRVGPS   STM   0,1,SCANPTR   Save string ptrs                  @SC86158 07205000
  214.          KCALL SUPFNC,1      Start intercepting                @SC86158 07206000
  215.          BR    9                                               @SC86295 07207000
  216. *                                                                       07208000
  217. SRVFIN   MVI   WRRD,0                Just write (no read) when ending   07209000
  218.          MVC   S1HND,SVHND   Always use requested handshake    @SC87343 07210000
  219.          BAL   2,SENDACK             Send an ACK                        07211000
  220.          L     1,WBUF        Ptr to decoded data               @SC86190 07212000
  221.          CLI   0(1),AL                                         @SC86190 07213000
  222.          BNE   SRVNOLOG      Skip logging out                  @SC86295 07214000
  223.          CLOSF LOGPTR        Close debug-log                   @SC86135 07215000
  224.          KCALL SUPFNC,8      Log out                           @SC86295 07216000
  225. SRVNOLOG DS    0H            (or fall through just in case)    @SC86295 07217000
  226.          MVC   ERRNUM(2),OLDERR Copy back error number         @SC90033 07218000
  227. SRVXIT   NI    FL2,255-SRV   Turn off SERVER mode              @SC86158 07219000
  228.          KCALL INTINI,0      Clear interrupt trapping                   07220000
  229.          RET                                                            07221000
  230. *                                                                       07221200
  231. SRVSTP   MVC   TIMOUT,SRVTIM Restore timeout                   @SC88074 07221400
  232.          B     SRVXIT                                          @SC88074 07221600
  233. *                                                                       07222000
  234. TRATOE   TR    0(,1),ATOE                                      @SC89215 07222300
  235. *                                                                       07222600
  236. RMHTXT   DC    C'Kermit-&KSYS. Server handles the following:'  @SC86268 07223000
  237.          DC    X'1515'                                         @SC86158 07224000
  238.          DC C'Function          Standard command',X'15'        @SC86158 07225000
  239.          DC C'--------          ----------------',X'1515'      @SC86158 07226000
  240.          DC C'Send a file       SEND file',X'15'               @SC86158 07227000
  241.          DC C'Retrieve a file   GET file',X'15'                @SC86158 07228000
  242.          DC C'Log off system    BYE or LOGOUT',X'15'           @SC86158 07229000
  243.          DC C'Exit from server  FINISH',X'15'                  @SC86158 07230000
  244.          DC C'Issue Kermit cmd  REMOTE KERMIT cmd',X'15'       @SC86158 07231000
  245.          DC C'Issue system cmd  REMOTE HOST [CP] cmd',X'15'    @SC86268 07232000
  246.          DC C'List directory    REMOTE DIRECTORY file',X'15'   @SC86158 07233000
  247.          DC C'Type a file       REMOTE TYPE file',X'15'        @SC86158 07234000
  248.          DC C'Copy a file       REMOTE COPY f1 f2',X'15'       @SC86158 07235000
  249.          DC C'Rename a file     REMOTE RENAME f1 f2',X'15'     @SC86158 07236000
  250.          DC C'Erase a file      REMOTE DELETE file',X'15'      @SC86158 07237000
  251.          DC C'Change disk area  REMOTE CWD area',X'15'         @SC86158 07238000
  252.          DC C'Show disk space   REMOTE SPACE area',X'15'       @SC86158 07239000
  253. RMHTXTZ  EQU   *                                               @SC86158 07240000
  254.          LOCALS ,                                              @SC86295 07241000
  255. RETADR   DS    A             Return adr if no more TAKE stuff  @SC86295 07242000
  256. CMDPTR   DS    A             Adr of command table              @SC86295 07243000
  257. TAKLEV   DS    F             Take file level                   @SC86121 07244000
  258. TAKTAB   DS    (TAKMAX)F     Tickets for I/O                   @SC86295 07245000
  259. SRVTIM   DS    X             Saved timeout limit               @SC86355 07246000
  260. SERVER   EXIT                                                           07247000
  261.          TITLE 'SEND Routine - sends a file'                            07248000
  262. * Send file(s) and set ERRNUM appropriately                             07249000
  263. * Entry: filespec pattern in IFILE                                      07250000
  264. SEND     ENTER                                                          07251000
  265.          XC    TOUTOT(LSTATS),TOUTOT Clear statistics          @SC86295 07252000
  266.          MVC   NSENTAC,F0    Number of files for acctng        @AB89191 07252500
  267.          KCALL SUPFNC,10                                       @SC86295 07253000
  268.          ST    15,SECTOT     Save start time                   @SC86295 07254000
  269.          ST    15,TINSV+12   Also for length tuning            @SC88325 07254200
  270.          ST    15,TINSV+28                                     @SC88325 07254400
  271.          ST    15,TINSV+44                                     @SC88325 07254600
  272.          TM    FL4,SFM                                         @SC86295 07255000
  273.          BO    *+10          From memory: keep old file list   @SC86295 07256000
  274.          XC    NSENT,NSENT           Number of files sent               07257000
  275.          MVI   SNFLG,FIRST   Haven't started yet               @SC86295 07258000
  276.          XC    FDATE,FDATE   Clear file date                   @SC86295 07259000
  277.          LA    0,TUNECT      Time to tune up                   @SC88349 07260000
  278.          STH   0,SNPKCT                                        @SC86345 07261000
  279.          MVI   REASON,0      Not rejected yet                  @SC86316 07262000
  280.          MVI   SEQ,0         Reset packet number               @SC86135 07263000
  281.          TM    FL4,SFM                                         @SC88100 07263300
  282.          BO    SNDS8         Just sending from memory          @SC88100 07263600
  283. SNDSET   OI    SNFLG,NEWGRP  Haven't started yet               @SC88306 07263800
  284.        NXTFSET IFILE,E=SNDNON Init for NXTFST call             @SC87012 07264000
  285. SNDS8    LA    8,SNDST       Set state table                   @SC89263 07265000
  286. SNDNXT   CLI   CXZ,AZ                                                   07269000
  287.          BE    SNDBRK        Stop file group send                       07270000
  288.          MVI   FRECF,C'F'    Just in case                      @SC86151 07271000
  289.          TM    FL4,SFM                                         @SC86158 07272000
  290.          BO    SNDNOW        Just sending from memory          @SC86158 07273000
  291.          NXTF  E=SNDNON      Get next/first file               @SC86295 07274000
  292.          MVI   CXZ,0                 In case aborted last file          07275000
  293.          MVI   REASON,0      Not rejected yet                  @SC86316 07276000
  294.          MVC   FLNOPTS(LFOPTS),IFOPTS Copy file options        @SC89218 07276500
  295.          L     5,TSENT               TABLE W/FILES SENT SO FAR          07277000
  296.          ICM   4,B'1111',NSENT       Number of files sent so far        07278000
  297.          AIF   ('&KSYS' NE 'CMS').SOPN                         @SC86295 07279000
  298.          BZ    SNDOPN        Go if none sent yet               @SC86295 07280000
  299. SNDTBL   CLC   0(16,5),FILNAM                                  @SC86295 07281000
  300.          BE    SNDNXT                Go if sent already                 07282000
  301.          A     5,FLFID1      Next filespec                     @SC88092 07283000
  302.          BCT   4,SNDTBL                                                 07284000
  303. .SOPN    ANOP                                                           07285000
  304. SNDOPN   OPENF I,FILNAM,FILFDB,FILPTR,E=SNDFNF                 @SC87012 07286000
  305.          USING FDBD,1                                          @SC86295 07287000
  306.          MVC   FRECF,FDBRCF  Save format and file size         @SC86295 07288000
  307.          MVC   KBYTES,FDBSIZE                                  @SC86295 07289000
  308.          MVC   FDATE,FDBDATE Save file date                    @SC86295 07290000
  309.          DROP  1                                               @SC86295 07291000
  310.          POINTF FILPTR,FLNOPTS,E=SNDSHRT Skip, if requested    @SC89218 07291500
  311.          CLI   TRMLIN,C' '   Alt. line?                        @SC87300 07292000
  312.          BE    SNDNOW        No, be quiet                      @SC87300 07293000
  313.          MVC   CMD(8),=CL8'Sending '  Yes, display message     @SC87300 07294000
  314.          LA    7,CMD+8                                         @SC87300 07295000
  315.          LA    1,FILNAM                                        @SC87300 07296000
  316.          BAL   2,STAFSP      Format name and show it           @SC87300 07297000
  317. SNDNOW   NI    SNFLG,255-NEWGRP Not first of this group        @SC88306 07298000
  318.          TM    SNFLG,FIRST                                     @SC86295 07298500
  319.          BZ    SNDFIL                Go if not first file               07299000
  320.          NI    SNFLG,255-FIRST No first file flag              @SC86295 07300000
  321.          MVC   LIMTRY,MAXTNT Limit for INIT retries            @SC86345 07301000
  322.          TM    FL4,NPS       Non-protocol?                     @HF86232 07302000
  323.          BZ    SNDPRO        No, normal send message           @HF86232 07303000
  324.          KCALL INTINI,5,E=SNDRET  Initialize for non-protocol  @SC87300 07304000
  325.          B     SNDATZ        Skip protocol stuff               @HF86232 07305000
  326. SNDPRO   KCALL INTINI,2,E=SNDRET  Initialize for send          @SC87300 07306000
  327.          TM    FL2,SRV                                                  07307000
  328.          BO    SNDINI                Go if Server mode                  07308000
  329.          L     0,LCLDLY      Time to wait                      @SC86164 07309000
  330.          KCALL SUPFNC,9                                        @SC86295 07310000
  331. SNDINI   DS    0H                                              @SC86152 07311000
  332.          KCALL RPARSET       Set up for exchange               @SC86152 07312000
  333.          KCALL RPAR          Our S packet to send              @SC86152 07313000
  334.          MVI   STYPE,AS              PACKET TYPE = SEND INITIATE        07314000
  335.          MVC   RTYPPRV,RTYPE Set up in case S packet gets lost @SC89263 07314500
  336.          BAL   9,INPUTSPK    Send RPAR and Interpret response  @SC86295 07315000
  337.          KCALL SPAR          Interpret reply to our S packet            07316000
  338.          MVC   BCTU,BCTR             Switch chksum to negotiated one    07317000
  339.          MVC   LIMTRY,MAXTRY Reset limit                       @SC86164 07318000
  340.          BAL   14,INCRSEQ                                               07319000
  341. SNDFIL   MVI   STYPE,AX      Text transmission?                @SC86158 07320000
  342.          TM    FL4,TXT                                         @SC86158 07321000
  343.          BO    *+8           Yes                               @SC86158 07322000
  344.          MVI   STYPE,AF      Packet type = file header         @SC86158 07323000
  345.          XC    DATL,DATL     Null file spec.                   @SC86158 07324000
  346.          TM    FL4,SFM                                         @SC86158 07325000
  347.          BNZ   SNDCNTH       From memory, no file name         @SC86158 07326000
  348.          BAL   9,PAKFIL      Compress to buffer with appends   @HF86223 07327000
  349.          CLI   TRMLIN,C' '   Alt. line?                        @SC87300 07328000
  350.          BE    SNDFIL2       No, be quiet                      @SC87300 07329000
  351.          MVC   CMD(5),=CL5'  as '  Yes, display message        @SC87300 07330000
  352.          L     1,RBUF        Ptr to name in ASCII              @SC87300 07331000
  353.          MVC   CMD+5(250),0(1)                                 @SC87300 07332000
  354.          TR    CMD+5(250),ATOED Back to EBCDIC                 @SC89301 07333000
  355.          LA    0,CMD+5(7)    End of msg + name                 @SC87300 07334000
  356.          BAL   2,STAPMSG     Show sending name                 @SC87300 07335000
  357. SNDFIL2  DS    0H                                              @SC87300 07336000
  358.          KCALL ACCTST,FILNAM Copy name to table                @SC88306 07337000
  359. SNDCNT   BAL   9,ENCODEN     Encode fn                         @SC86295 07346000
  360. SNDCNTH  BAL   9,INPUTSPK    Send name and interpret response  @SC86295 07347000
  361.          BAL   14,INCRSEQ                                               07348000
  362.          MVC   TMP,SCAPA     Copy my flags                     @SC86149 07349000
  363.          NI    TMP,8         Attributes                        @SC86149 07350000
  364.          NC    TMP,RCAPA     Check if both on                  @SC86149 07351000
  365.          BZ    SNDATZ        No, skip it                       @SC86149 07352000
  366.          L     5,ASDATA                                        @SC86295 07353000
  367.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07353500
  368.          ICM   4,15,KBYTES   File length known?                @SC86295 07354000
  369.          BZ    SNDAT0        No, skip it                       @SC86316 07355000
  370.          TM    ATFLG,ATFLNG  Length attribute desired?         @SC90037 07355300
  371.          BZ    SNDAT0        No, skip it                       @SC90037 07355600
  372.          MVI   0(5),AEXCL    Yes, ASCII ! => size              @SC88273 07356000
  373.          LA    15,2(5)                                         @SC86295 07357000
  374.          BAL   2,EDDEC       Format it                         @SC86295 07358000
  375.          TR    2(9,5),ETOAD  Convert plenty to ASCII           @SC88273 07358500
  376.          SR    15,5                                            @SC86295 07359000
  377.          LA    4,ABL-2(15)   Number of digits (printably)      @SC88273 07360000
  378.          STC   4,1(5)                                          @SC86295 07361000
  379.          AR    5,15          End of string                     @SC86295 07362000
  380. SNDAT0   TM    ATFL2,ATFORG  Origin wanted?                    @SC90037 07363000
  381.          BZ    SNDAT0B       No, skip it                       @SC90037 07363200
  382.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07363400
  383.          MVC   0(LSYSATR,5),SYSATR                             @SC90037 07363600
  384.          LA    5,LSYSATR(5) System code                        @SC88273 07364000
  385. SNDAT0B  TM    ATFLG,ATFTYP  Type wanted?                      @SC90037 07364200
  386.          BZ    SNDAT1Z       No, skip it and encoding too      @SC90037 07364400
  387.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07364600
  388.          MVC   0(3,5),=AL1(ABL+2,ABL+1,AB) "!B - it's binary   @SC88273 07365000
  389.          TM    FL4,SFM       Sending from memory buffer?       @SC90016 07365300
  390.          BO    *+12          Yes, always text file             @SC90016 07365600
  391.          TM    FL1,BINF      Binary file?                      @SC86149 07366000
  392.          BO    SNDAT1        Yes                               @SC86316 07367000
  393.          MVC   2(4,5),=AL1(AA,ABL+10,ABL+1,AA) A*!A - ASCII    @SC88273 07368000
  394.          TM    ATFL2,ATFENC  Encoding wanted?                  @SC90037 07368300
  395.          BZ    SNDAT1        No, skip it                       @SC90037 07368600
  396.          LA    5,3(5)        Advance over extra item           @SC86316 07369000
  397.          ICM   2,15,CDESPTR                                    @SC90040 07369080
  398.          BZ    SNDAT1                                          @SC90040 07369160
  399.          MVI   2(5),AC       Level-1 syntax                    @SC90040 07369240
  400.          SR    1,1                                             @SC90040 07369320
  401.          IC    1,4(,2)       Get length of designator          @SC90040 07369400
  402.          LA    0,ABL+1(,1)   Modified length of ENC attribute  @SC90040 07369480
  403.          STC   0,1(,5)                                         @SC90040 07369560
  404.          MVC   3(11,5),5(2)  Copy plenty of text               @SC90040 07369640
  405.          AR    5,1           Account for extra stuff           @SC90040 07369720
  406. SNDAT1   LA    5,3(5)                                          @SC86316 07370000
  407. SNDAT1Z  TM    ATFL2,ATFFMT  Format wanted?                    @SC90037 07370200
  408.          BZ    SNDAT3        No, skip it                       @SC90037 07370400
  409.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07370600
  410.          IC    4,TYPFIL      Specific file type                @SC86295 07371000
  411.          BAL   2,CLKP        Dispatch via table                @SC86295 07372000
  412.          DC    C'T',AL3(SNDATT)  Text                          @SC86295 07373000
  413.          DC    C'D',AL3(SNDATD)  D-binary                      @SC86295 07374000
  414.          DC    C'V',AL3(SNDATV)  V-binary                      @SC86295 07375000
  415.          DC    X'0',AL3(SNDAT3)  Must be Binary                @SC86295 07376000
  416. SNDATT   BAL   2,SNDAT2                                        @SC86295 07377000
  417.          DC    AL1(ABL+3,AA,AM,AJ) #AMJ Delimited              @SC88273 07378000
  418. SNDATD   BAL   2,SNDAT2                                        @SC86295 07379000
  419.          DC    AL1(ABL+2,AD,A5)    "D5  Undelimited 5-byte pref@SC90037 07380000
  420. SNDATV   BAL   2,SNDAT2                                        @SC86295 07381000
  421.          DC    AL1(ABL+2,AV,A2)    "V2  2-byte bin. pref.      @SC90037 07382000
  422. SNDAT2   MVI   0(5),ABL+15   ASCII / => Format                 @SC88273 07383000
  423.          MVC   1(9,5),0(2)   Copy string                       @SC86295 07384000
  424.          UNCHR 4,0(2)        Get length                        @SC88273 07385000
  425.          LA    5,2(4,5)      Update string ptr                 @SC86295 07388000
  426. SNDAT3   CLI   FDATE,0       File date defined?                @SC86295 07389000
  427.          BE    SNDAT5        No, skip it                       @SC90037 07390000
  428.          TM    ATFLG,ATFDAT  Date wanted?                      @SC90037 07390200
  429.          BZ    SNDAT5        No, skip it                       @SC90037 07390400
  430.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07390600
  431.          MVC   0(2,5),=AL1(A#,ABL+8) Yes, yyyymmdd (ASCII #)   @SC88273 07391000
  432.          UNPK  2(9,5),FDATE(5) Insert zones                    @SC86295 07392000
  433.          LA    4,10(5)       End of date                       @SC88273 07392040
  434.          CLC   FDATE+4(3),F0 Time defined too?                 @SC88235 07392090
  435.          BE    SNDAT4        No, just use date                 @SC88235 07392180
  436.          MVI   1(5),ABL+17   Yes, add string length - hh:mm:ss @SC88273 07392270
  437.          MVC   10(9,5),TIMPLT and edit time                    @SC88235 07392360
  438.          ED    10(9,5),FDATE+4                                 @SC88235 07392450
  439.          CLI   11(5),C' '                                      @SC88235 07392540
  440.          BNE   *+8                                             @SC88235 07392630
  441.          MVI   11(5),C'0'    Insist on leading zeroes          @SC88235 07392720
  442.          LA    4,9(4)        Advance over time                 @SC88273 07392900
  443. SNDAT4   TR    2(17,5),ETOAD Convert date/time to ASCII        @SC88273 07393100
  444.          LR    5,4           New ptr in either case            @SC88273 07393300
  445. SNDAT5   DS    0H                                              @SC90037 07393380
  446.          BAL   2,SNDPKLC     Check length of attribute info    @SC90037 07393460
  447.          SR    8,8           Unconditionally send all          @SC90037 07393540
  448.          LA    2,SNDATZ      Place to go when done             @SC90037 07393620
  449.          ST    2,SNDPKLR                                       @SC90037 07393700
  450.          B     SNDAT9                                          @SC90037 07393780
  451. * Send A-packet if buffer full.  Use last version that fit.    @SC90037 07393860
  452. SNDPKLC  L     8,MAXSIZ      Set limit for packet              @SC90037 07393940
  453. SNDAT9   L     15,ASDATA                                       @SC86295 07394000
  454.          SR    5,15                                            @SC86295 07395000
  455.          BNP   SNDPKLZ                                         @SC90037 07395300
  456.          CR    5,8           Full yet?                         @SC90037 07395600
  457.          BNH   SNDPKLZ       No, go back for more              @SC90037 07395900
  458.          ICM   5,15,SNDPKLN  Length from last time through     @SC90037 07396200
  459.          BZ    SNDPKLZ       This shouldn't happen             @SC90037 07396500
  460.          ST    5,DATL        Set length                        @SC86295 07397000
  461.          LA    8,SNDST       Restore state ptr                 @SC89263 07398000
  462.          MVI   STYPE,AA                                        @SC86149 07399000
  463.          BAL   9,INPUTSPK    Send it                           @SC86295 07400000
  464.          BAL   14,INCRSEQ                                      @SC86149 07401000
  465.          CLC   DATL,F0       Any objections?                   @SC86149 07402000
  466.          BE    SNDPKLX       Ok                                @SC90037 07403000
  467.          L     1,ARDATA                                        @SC86316 07404000
  468.          CLI   0(1),AN       Refused?                          @SC86149 07405000
  469.          BE    SNDCAN        Sigh                              @SC86149 07406000
  470. SNDPKLX  SR    5,5           Clear length to send              @SC90037 07406100
  471.          L     2,SNDPKLR     Will have to redo                 @SC90037 07406200
  472. SNDPKLZ  ST    5,SNDPKLN     Save length available             @SC90037 07406300
  473.          A     5,ASDATA      Restore as ptr into buffer        @SC90037 07406400
  474.          ST    2,SNDPKLR     Where to go if need to redo       @SC90037 07406500
  475.          BR    2                                               @SC90037 07406600
  476. *                                                              @SC90037 07406700
  477. SNDATZ   DS    0H                                              @SC86149 07407000
  478.          NI    FL1,255-EOF           Not end of file yet                07408000
  479.          BAL   14,RDWSET     Check for special format          @SC86151 07409000
  480.          XC    RBUFL,RBUFL           No data in input buffer            07410000
  481.          TM    FL4,NPS       Non-protocol?                     @SC86165 07411000
  482.          BO    SNDNPS        Yes, do it                        @SC86165 07412000
  483. SNDENC   KCALL ENCODE,E=SNDENX Encode the data and more                 07413000
  484. SNDDAT   MVI   STYPE,AD              PACKET TYPE = DATA                 07414000
  485.          BAL   9,INPUTSPK    Send data and interpret reply     @SC86295 07415000
  486.          BAL   14,INCRSEQ                                               07416000
  487.          LH    15,SNPKCT                                       @SC86345 07417000
  488.          BCT   15,SNDTUNZ    No tuning yet                     @SC86345 07418000
  489.          CLC   MAXSIZ+4,AKMAX Long packets selected?           @SC86345 07419000
  490.          BNP   SNDTUNY       No                                @SC86345 07420000
  491.          KCALL SUPFNC,10     Get time                          @SC88325 07421000
  492.          ST    15,CSECTOT    Save                              @SC88325 07421300
  493.          KCALL OPTPKT        Calculate optimum size            @SC88325 07421600
  494.          LTR   15,15         Valid?                            @SC86345 07422000
  495.          BNP   SNDTUNY       No                                @SC86345 07423000
  496.          C     15,MAXSIZ+4   Other Kermit's limit              @SC86345 07424000
  497.          BNH   *+8                                             @SC86345 07425000
  498.          L     15,MAXSIZ+4                                     @SC86345 07426000
  499.          C     15,AKMAX                                        @SC86345 07427000
  500.          BNL   *+8                                             @SC86345 07428000
  501.          L     15,AKMAX      Don't get too small               @SC86345 07429000
  502.          ST    15,MAXSIZ     Set send limit                    @SC86345 07430000
  503. SNDTUNY  LA    15,TUNECT     Repeat target                     @SC88349 07431000
  504. SNDTUNZ  STH   15,SNPKCT                                       @SC86345 07432000
  505.          CLC   DATL,F1                                                  07433000
  506.          BNE   SNDENC                Go if no Data in ack               07434000
  507.          L     1,ARDATA                                        @SC86190 07435000
  508.          CLI   0(1),AX                                         @SC86190 07436000
  509.          BE    SNDCAN                Go if Abort sending file           07437000
  510.          CLI   0(1),AZ                                         @SC86190 07438000
  511.          BNE   SNDENC                Go if not Abort sending grp        07439000
  512. SNDCAN   MVC   CXZ,0(1)      Pick up data                      @SC86190 07440000
  513.          MVI   ERRNUM,ERRTRC Send cancelled                    @SC86156 07441000
  514.          CLC   DATL,F2       Any reason given (if A-pkt)       @SC86316 07442000
  515.          BL    SNDEOF        None                              @SC86316 07443000
  516.          UNCHR 2,1(1),REASON Yes, save it                      @SC86316 07444000
  517. SNDEOF   BAL   9,SNDCLS      Close file                        @SC86295 07445000
  518.          KCALL ACCTNG        Save code in table                @SC88092 07445500
  519.          MVI   STYPE,AZ              PACKET TYPE = EOF                  07446000
  520.          XC    DATL,DATL                                                07447000
  521.          L     9,ASDATA                                        @SC86295 07448000
  522.          MVI   0(9),AD       In case of discard                @SC86295 07449000
  523.          CLI   CXZ,0         Aborting this file?               @SC86125 07450000
  524.          BE    *+8           No, ok                            @SC86125 07451000
  525.          MVI   DATL+3,1      Yes, send 'D'                     @SC86125 07452000
  526.          BAL   9,INPUTSPK    Send EOF and Interpret response   @SC86295 07453000
  527.          BAL   14,INCRSEQ                                               07454000
  528.          TM    FL4,SFM                                         @SC86158 07455000
  529.          BO    SNDBRK        Memory has only one 'file'        @SC86158 07456000
  530.          B     SNDNXT                else GET-NEXT-FILE                 07457000
  531. *                                                                       07458000
  532. SNDNPS   MVI   WRRD,0        Set for send only                 @SC86165 07459000
  533. SNDNPSL  KCALL NPREAD,E=(SNDABR,P)                             @SC86165 07460000
  534.          CLC   SNDPKL,F0     OK, any data?                     @SC86165 07461000
  535.          BE    SNDNPZ        No, must be done                  @SC86165 07462000
  536.          KCALL SIO,E=SNDABR  Send what we got                  @SC86165 07463000
  537.          TM    FL1,EOF       Any more?                         @SC86165 07464000
  538.          BZ    SNDNPSL       Yes, get it                       @SC86165 07465000
  539. SNDNPZ   BAL   9,SNDCLS      Reached end                       @SC86295 07466000
  540.          B     SNDBR2        All done                          @SC86165 07467000
  541. *                                                                       07468000
  542. SNDENX   LTR   15,15                 Positive or negative error?        07469000
  543.          BP    SNDABR                Pos: error from ENCODE, not EOF    07470000
  544.          MVI   ERRNUM,ERRNOE No error yet                      @SC88092 07470500
  545.          CLC   DATL,F0                                                  07471000
  546.          BE    SNDEOF                No more data to send               07472000
  547.          B     SNDDAT                Send last chunk                    07473000
  548. *                                                                       07474000
  549. SNDNON   TM    SNFLG,NEWGRP                                    @SC88306 07475000
  550.          BZ    SNDMNXT       Filespec wasn't totally missing   @SC89218 07475200
  551. SNDFNF   MVI   ERRNUM,ERRFNF Not found                         @SC87012 07475230
  552.          KCALL ACCTST,IFILE  Copy name to table                @SC88306 07475260
  553. SNDACT   KCALL ACCTNG        Set error number                  @SC89218 07475290
  554. SNDMNXT  DS    0H                                              @SC89218 07475320
  555.          CLC   MSNDPTR,MSNDBUF Any more filespecs pending?     @SC88306 07475400
  556.          BNH   SNDBRK        No, all done                      @SC88306 07475600
  557.          L     1,MSNDPTR                                       @SC88306 07475800
  558.          SH    1,=Y(LFSTF)   Back up to next filespec          @SC89218 07476000
  559.          ST    1,MSNDPTR     And save new ptr                  @SC88306 07476200
  560.          MVC   IFILE(LFSTF),0(1) Copy out names                @SC89218 07476400
  561.          B     SNDSET        Start all over again              @SC88306 07476800
  562. *                                                                       07477000
  563. SNDBRK   MVC   ERRNUM(2),ERRLAST Last error code+reason code   @SC89218 07477100
  564.          CLI   ERRNUM,ERRNOE Last transfer ok?                 @SC89218 07477200
  565.          BE    SNDBRKP       Yes                               @SC89218 07477300
  566.          TM    SNFLG,FIRST                                     @SC88306 07477600
  567.          BZ    SNDAB2        Send E-packet: transfer started   @SC89218 07477800
  568.          TM    FL2,SRV                                                  07478000
  569.          BO    SNDAB2        Go if server                      @SC89218 07479000
  570.          B     SNDRET                                          @SC86295 07480000
  571. *                                                                       07480100
  572. SNDSHRT  BAL   9,SNDCLS      Close input file                  @SC89218 07480200
  573.          NI    SNFLG,255-NEWGRP Not first of the group anymore @SC89218 07480300
  574.          MVI   ERRNUM,ERRFTS File too short for request        @SC89218 07480400
  575.          KCALL ACCTST,FILNAM Copy name to table                @SC89218 07480500
  576.          B     SNDACT        On to next file, if any           @SC89218 07480600
  577. *                                                                       07481000
  578. SNDBRKP  TM    SNFLG,FIRST   See if actually started           @SC89218 07482000
  579.          BO    SNDRET        No, just quit                     @SC89218 07482300
  580.          MVI   STYPE,AB      Packet type = BREAK               @SC89218 07482600
  581.          XC    DATL,DATL                                                07483000
  582.          BAL   9,INPUTSPK    Send BRK and Interpret response   @SC86295 07484000
  583. SNDBR2   DS    0H                                              @SC86165 07485000
  584.          MVC   ERRNUM(2),ERRLAST Reset error+reason            @SC89218 07486000
  585.          B     SNDRET        Done                              @SC89218 07487000
  586. *                                                                       07488000
  587. SNDABR   BAL   9,SNDCLS      Close disk file                   @SC86295 07490000
  588.          KCALL ACCTNG        Save code in table                @SC88092 07490500
  589. SNDAB2   DS    0H                                              @SC89218 07490700
  590.          TM    FL4,NPS       Non-protocol?                     @SC86165 07491000
  591.          BO    SNDRET        Yes, skip error packet            @SC86165 07492000
  592.          KCALL ERPACK        Send error packet                          07493000
  593. SNDRET   NI    FL4,255-NPS-SFM-TXT                             @SC86165 07494000
  594.          LA    0,0           Indicate return from SEND         @AB89191 07494500
  595.          B     RETSNRC       Close statistics and return       @SC86295 07495000
  596. *                                                                       07496000
  597. SNDCLS   TM    FL4,SFM       Text xmit?                        @SC86158 07497000
  598.          BOR   9             Yes, no disk file                 @SC86295 07498000
  599.          CLOSF FILPTR        Close it                          @SC86158 07499000
  600.          BR    9                                               @SC86295 07500000
  601. *                                                                       07500300
  602. TIMPLT   DC    C' ',X'2120',C':',2X'20',C':',2X'20'  Time edit @SC88235 07500600
  603.          LOCALS ,                                              @SC86295 07501000
  604. SNPKCT   DS    H             Cyclic counter for tuning         @SC86345 07502000
  605. CXZ      DS    X             Flag for aborted transmission     @SC86295 07503000
  606. SNFLG    DS    X             More local flags                  @SC86295 07504000
  607. FIRST    EQU   X'80'         File is the first one             @SC86295 07505000
  608. NEWGRP   EQU   X'40'         File is the first of a new group  @SC88306 07505500
  609. SNDPKLR  DS    A             Saved return adr for attribute    @SC90037 07505600
  610. SNDPKLN  DS    F             Length of attributes composed     @SC90037 07505700
  611. SEND     EXIT                                                           07506000
  612.          TITLE 'RECEIV Routine - receives a file'                       07507000
  613. * Receive file(s) and set ERRNUM appropriately                          07508000
  614. * Entry: filespec in FILNAM if ROVR is set                              07509000
  615. RECEIV   ENTER                                                          07510000
  616.          XC    TOUTOT(LSTATS),TOUTOT Clear statistics          @SC86295 07511000
  617.          XC    NSENT,NSENT   Clear count of files              @SC88092 07511500
  618.          MVC   NSENTAC,F0    Number of files for acctng        @AB89191 07511700
  619.          MVC   FL1SV,FL1     Save file attribute defaults:     @SC90037 07511760
  620.          MVC   TYPFSV,TYPFIL File type...                      @SC90037 07511820
  621.          MVC   RCFSV,FILRCF  Format                            @SC90037 07511880
  622.          MVC   LRCSV,FILLRC  Record length...                  @SC90037 07511940
  623.          KCALL SUPFNC,10                                       @SC86295 07512000
  624.          ST    15,SECTOT     Save start time                   @SC86295 07513000
  625.          CLI   RTYPE,AF      Starting with file header packet? @SC88074 07514000
  626.          BE    RECFHD        Yes, skip INIT stuff              @SC88074 07514200
  627.          CLI   RTYPE,AX                                        @SC88074 07514400
  628.          BE    RECFHD        Yes, skip INIT stuff              @SC88074 07514600
  629.          KCALL SPARSET       Set up for exchange               @SC86152 07515000
  630.          LA    8,RECINST             Next state table for RECEIVE I     07516000
  631.          MVC   LIMTRY,MAXTNT Limit for INIT retries            @SC86345 07517000
  632.          CLI   RTYPE,0                                         @SC88074 07518000
  633.          BNE   RECSRV        Skip read if already got packet   @SC88074 07518500
  634.          MVI   SEQ,0         Reset packet number               @SC88074 07519000
  635.          KCALL RPACK         Get init info                              07520000
  636. RECSRV   SR    3,3                   Clear retry counter for INPUTLUP   07521000
  637.          BAL   9,INPUTINR    Interpret response to RPAC        @SC86295 07522000
  638.          KCALL SPAR          Interpret his S packet                     07523000
  639.          KCALL RPAR          Reply to the S packet                      07524000
  640.          BAL   2,SENDACKL            Send an ACK, length set            07525000
  641.          MVC   BCTU,BCTR             Restore desired chksum             07526000
  642.          MVC   LIMTRY,MAXTRY Set retry limit                   @SC86164 07527000
  643.          BAL   14,INCRSEQ                                               07528000
  644. RECFIL   KCALL RPACK         Get header packet                 @SC88074 07529000
  645. RECFHD   LA    8,RECFNST     Next state table for RECEIVE F    @SC88074 07529500
  646.          SR    3,3           Clear retry counter for INPUTLUP  @SC88074 07530000
  647.          BAL   9,INPUTINR    Interpret header packet           @SC88074 07530500
  648.          NI    RFLG,255-RTRC-RRJC Clear each time              @SC86316 07531000
  649.          MVI   REASON,0                                                 07532000
  650.          NI    FL1,255-EOF           Turn of EOF = no ctl-z seen        07533000
  651.          MVC   FILFSIZ,F0    Clear expected size in Kbytes     @SC90037 07533500
  652.          TM    FL1,ROVR                                                 07534000
  653.          BO    RECOVR                Overwrite the name sent?           07535000
  654.          BAL   9,DECODEN     Decode the input                  @SC86295 07536000
  655.          L     1,WBUF                Start of data                      07537000
  656.          L     0,WBUFL               Data length decoded                07538000
  657.          TR    0(256,1),ATOED Convert to std EBCDIC            @SC89301 07539000
  658.          STM   0,1,SCANPTR   Set up scan                       @SC86295 07540000
  659.          MVC   CMD+5(250),0(1)  Extra copy for display         @SC87300 07541000
  660.          LA    0,FFHDR                                         @SC86295 07542000
  661.          KCALL FSPEC,FILNAM                                    @SC86295 07543000
  662.          CLI   TRMLIN,C' '   Alt. line?                        @SC87300 07544000
  663.          BE    RECOVR        No, be quiet                      @SC87300 07545000
  664.          MVC   CMD(5),=CL5'File '  Yes, display message        @SC87300 07546000
  665.          LA    0,CMD+5                                         @SC87300 07547000
  666.          A     0,WBUFL                                         @SC87300 07548000
  667.          BAL   2,STAPMSG     Show name                         @SC87300 07549000
  668. RECOVR   LA    3,FILNAM              Point to fn                        07550000
  669.          TM    FL3,APPN      Appending to old files?           @SC86203 07551000
  670.          BO    RECOPN        Yes, just do it                   @SC86295 07552000
  671.          TM    FL1,REN                                                  07553000
  672.          BZ    RECOPN        No, just do it                    @SC86295 07554000
  673.          LA    0,FFNEW                                         @SC86295 07555000
  674.          KCALL FSPEC,FILNAM,E=RECNER Check collisions          @SC88053 07556000
  675.          TM    FL4,NMCHNG                                      @SC90033 07556040
  676.          BZ    RECCMSG                                         @SC90033 07556080
  677.          CLI   CLSNFL,C'B'                                     @SC90033 07556120
  678.          BNE   RECCTSTD                                        @SC90033 07556160
  679.          LA    2,FILNAM      Must back up original file        @SC90033 07556200
  680.          LA    0,15          Rename it to unique new name      @SC90033 07556240
  681.          KCALL DISKIO,XFILE                                    @SC90033 07556280
  682.          CLI   TRMLIN,C' '   Alt. line?                        @SC90033 07556320
  683.          BE    RECCBZ        No, be quiet                      @SC90033 07556360
  684.          MVC   CMD(9),=CL24'--original backed up as '          @SC90033 07556400
  685.          LA    7,CMD+24                                        @SC90033 07556440
  686.          LA    1,FILNAM                                        @SC90033 07556480
  687.          BAL   2,STAFSP      Format backup name and show it    @SC90033 07556520
  688. RECCBZ   MVC   FILNAM,XFILE  Now, just use intended name       @SC90033 07556560
  689.          B     RECCMSG                                         @SC90033 07556600
  690. RECCTSTD CLI   CLSNFL,C'D'                                     @SC90033 07556640
  691.          BNE   RECCMSG       Other case is just "rename"       @SC90033 07556680
  692.          OI    RFLG,RRJC     Reject file                       @SC90033 07556720
  693.          MVI   REASON,STACNCLS Reason was file collision       @SC90033 07556760
  694.          CLI   TRMLIN,C' '   Alt. line?                        @SC90033 07556800
  695.          BE    RECOPN        No, be quiet                      @SC90033 07556840
  696.          WTEXT '--discarded as duplicate'                      @SC90033 07556880
  697.          B     RECOPN                                          @SC90033 07556920
  698. RECCMSG  DS    0H                                              @SC90033 07556960
  699.          CLI   TRMLIN,C' '   Alt. line?                        @SC87300 07557000
  700.          BE    RECOPN        No, be quiet                      @SC87300 07558000
  701.          MVC   CMD(9),=CL9'  Rcv as '  Yes, display message    @SC87300 07559000
  702.          LA    7,CMD+9                                         @SC87300 07560000
  703.          LA    1,FILNAM                                        @SC87300 07561000
  704.          BAL   2,STAFSP      Format name and show it           @SC87300 07562000
  705. RECOPN   XC    FILFLGS,FL3   Set flag for DISP                 @SC86295 07563000
  706.          NI    FILFLGS,255-APPN-SVATT                          @SC90033 07564000
  707.          XC    FILFLGS,FL3                                     @SC86295 07565000
  708.          KCALL ACCTST,FILNAM Copy name to table                @SC88306 07565500
  709.          L     7,RBUF        Ptr to input buffer               @SC88264 07574000
  710.          LA    0,FFDSP                                         @SC88264 07574080
  711.          KCALL FSPEC,FILNAM  Copy chosen name into buffer      @SC88264 07574160
  712.          L     2,RBUF                                          @SC88264 07574240
  713.          LR    3,15          End of string                     @SC88264 07574320
  714.          SR    3,2           Get length of string              @SC88264 07574400
  715.          ST    3,RBUFL                                         @SC88264 07574480
  716.          LA    15,ETOAD      Standard table                    @SC89301 07574560
  717.          BAL   14,TRANSLAT   Convert to ASCII                  @SC88264 07574640
  718.          BAL   9,ENCODEN     Copy into packet buffer           @SC88264 07574720
  719.          BAL   2,SENDACKL                                      @SC88264 07574800
  720.          XC    WBUFL,WBUFL           Data length in WBUF                07575000
  721.          MVI   PREV,0                Char previously decoded            07576000
  722.          LA    8,RECANST     State table: REC D or A           @SC86149 07577000
  723. RECDAT   BAL   14,INCRSEQ                                      @SC86316 07578000
  724.          BAL   9,INPUT       Read a packet and interpret       @SC86295 07579000
  725.          LA    9,RECDNST     From now on accept D only         @SC90037 07580010
  726.          CR    8,9           Already seen a D packet?          @SC90037 07580020
  727.          BE    RECDATN       Yes, handle routinely             @SC90037 07580030
  728.          LR    8,9           No, 1st open file                 @SC90037 07580040
  729.          TM    RFLG,RRJC     File rejected?                    @SC90037 07580050
  730.          BO    RECRJX        Yes, ignore all data              @SC90037 07580060
  731.          OPENF O,FILNAM,FILFDB,FILPTR,E=RECRER                 @SC86295 07580070
  732.          USING FDBD,1                                          @SC86295 07580080
  733.          L     2,FABLRTR     Get effective record length       @SC88120 07580090
  734.          ST    2,FSIZE       Copy LRECL                        @SC86295 07580100
  735.          MVC   FRECF,FDBRCF  Save info                         @SC86295 07580110
  736.          DROP  1                                               @SC86295 07580120
  737.          TM    FL1,BINF                                        @SC88120 07580130
  738.          BO    RECMAXO       Binary, just fold at LRECL        @SC88120 07580140
  739.          CLI   TRNCFL,C'H'   Test: F, H, or T                  @SC88120 07580150
  740.          BL    RECMAXO       F => fold at LRECL                @SC88120 07580160
  741.          LA    2,1(2)        Assume H => abort at LRECL+1      @SC88120 07580170
  742.          BE    RECMAXO                                         @SC88120 07580180
  743.          ICM   2,8,LOBIT+3   T => fold at "infinity", but trunc@SC88120 07580190
  744. RECMAXO  ST    2,MAXOUT                                        @SC88120 07580200
  745.          BAL   14,RDWSET     Check for special format          @SC86295 07580210
  746.          ICM   0,15,FILFSIZ  Expected size, if known           @SC90037 07580220
  747.          BZ    RECDATN       Not known, proceed                @SC90037 07580230
  748.          OPENF S,FILNAM,FILFDB,FILPTR,E=RECRJL Check disk space@SC90037 07580240
  749. RECDATN  DS    0H                                              @SC90037 07580250
  750.          TM    RFLG,RRJC     File rejected?                    @SC89218 07580300
  751.          BO    RECRJX        Yes, ignore all data              @SC90033 07580600
  752.          KCALL DECODE,E=RECABR Decode and write to file        @SC86316 07581000
  753. RECDAK   BAL   2,SENDACK     Send an ack                       @SC86149 07582000
  754.          B     RECDAT                                                   07583000
  755. *                                                                       07584000
  756. RECSCN   LR    7,6           Start one before number           @SC90037 07584030
  757. RECSCL   CLI   0(7),ACOM     Look for comma                    @SC90037 07584060
  758.          BER   14            Found one                         @SC90037 07584090
  759.          CR    7,5                                             @SC90037 07584120
  760.          BNLR  14            Already at end of string          @SC90037 07584150
  761.          LA    7,1(,7)                                         @SC90037 07584180
  762.          B     RECSCL        Keep looking                      @SC90037 07584210
  763. *                                                                       07584240
  764. RECALKP  LTR   7,7                                             @SC90037 07584270
  765.          BNP   RECRJC        No value at all.  Give up         @SC90037 07584300
  766.          IC    4,0(,6)       Get value code                    @SC90037 07584330
  767.          LA    6,1(,6)       Advance scan ptr over code char   @SC90037 07584360
  768.          BCTR  7,0           Length of stuff left              @SC90037 07584390
  769.          B     CLKP          Dispatch on value, table at (2)   @SC90037 07584420
  770. *                                                                       07584450
  771. RECAMJ   NI    FL1,255-BINF  Set it Text                       @SC90037 07584480
  772.          MVI   TYPFIL,C'T'                                     @SC90037 07584510
  773.          LTR   7,7           Any more stuff?                   @SC90037 07584540
  774.          BZR   14            No, assume AMJ                    @SC90037 07584570
  775.          C     7,F2          Yes, had better be AMJ!           @SC90037 07584600
  776.          BNE   RECRJC        Isn't AMJ, give up                @SC90037 07584630
  777.          CLC   0(2,6),=AL1(AM,AJ)                              @SC90037 07584660
  778.          BNE   RECRJC        Isn't AMJ, give up                @SC90037 07584690
  779.          BR    14            Ok                                @SC90037 07584720
  780. *                                                                       07584750
  781. RECCKA   L     5,ARDATA      Attributes                        @SC88273 07585000
  782.          L     3,DATL        Get length                        @SC86316 07587000
  783.          AR    3,5           Ptr to end                        @SC88273 07588000
  784.          MVI   ERRNUM,ERRIPS In case of error                  @SC86316 07591000
  785. RECCKL   CR    5,3           Another attribute?                @SC86316 07592000
  786.          BNL   RECDAK        No, done                          @SC86316 07593000
  787.          TM    RFLG,RRJC     File rejected?                    @SC90033 07593300
  788.          BO    RECDAK        Yes, ignore further attributes    @SC90033 07593600
  789.          UNCHR 4,0(5),REASON Get code                          @SC90037 07594000
  790.          BNP   RECABR        Invalid: code must be >0          @SC90037 07594500
  791.          UNCHR 7,1(5)        Get length of value               @SC88273 07595000
  792.          BM    RECABR        Invalid: length was <0            @SC86316 07599000
  793.          LA    6,2(5)        Space over code+length            @SC88273 07600000
  794.          LA    5,0(7,6)      Next field                        @SC86316 07601000
  795.          CR    5,3           Does it match?                    @SC86316 07602000
  796.          BH    RECABR        Overflows data                    @SC86316 07603000
  797.          LR    14,4                                            @SC90037 07603090
  798.          BCTR  14,0          Bit index for this attribute      @SC90037 07603180
  799.          SRDL  14,3          Get byte index                    @SC90037 07603270
  800.          SRL   15,29         And bit remainder                 @SC90037 07603360
  801.          LA    1,X'80'                                         @SC90037 07603450
  802.          SRL   1,0(15)       Convert to bit mask               @SC90037 07603540
  803.          IC    15,ATFLG(14)  Load attribute flags              @SC90037 07603630
  804.          NR    15,1          Honor this attribute?             @SC90037 07603720
  805.          BZ    RECCKL        No, just ignore it                @SC90037 07603810
  806.          BAL   2,CLKP                                          @SC86316 07604000
  807. RECLNCOD DC    AL1(01),AL3(RECALN) ! - File length             @SC90037 07605000
  808.          DC    AL1(02),AL3(RECATP) " - Type                    @SC90037 07605100
  809.          DC    AL1(09),AL3(RECAAC) ) - Access                  @SC90037 07605200
  810.          DC    AL1(10),AL3(RECAEN) * - Encoding                @SC90037 07605300
  811.          DC    AL1(11),AL3(RECADI) + - Disposition             @SC90037 07605400
  812.          DC    AL1(15),AL3(RECAFM) / - Format                  @SC90037 07605500
  813.          DC    X'0',AL3(RECCKL) Other                          @SC86316 07606000
  814. *          Access attribute                                    @SC90037 07606020
  815. RECAAC   BAL   2,RECALKP                                       @SC90037 07606040
  816.          DC    AL1(AA),AL3(RECAAA) Append                      @SC90037 07606060
  817.          DC    AL1(AN),AL3(RECCKL) Normal (obey user)          @SC90037 07606080
  818.          DC    AL1(AS),AL3(RECAAS) Supersede                   @SC90037 07606100
  819.          DC    AL1(00),AL3(RECRJC) unknown, reject             @SC90037 07606120
  820. RECAAA   OI    FILFLGS,APPN  Append                            @SC90037 07606140
  821.          B     RECCKL                                          @SC90037 07606160
  822. RECAAS   NI    FILFLGS,255-APPN Don't append                   @SC90037 07606180
  823.          B     RECCKL                                          @SC90037 07606200
  824. *          Format attribute                                    @SC90037 07606220
  825. RECAFM   BAL   14,RECSCN     Check for comma                   @SC90037 07606240
  826.          SR    7,6           Length of extra stuff             @SC90037 07606260
  827.          BAL   2,RECALKP                                       @SC90037 07606280
  828.          DC    AL1(AA),AL3(RECAFA) ASCII                       @SC90037 07606300
  829.          DC    AL1(AD),AL3(RECAFD) D (binary)                  @SC90037 07606320
  830.          DC    AL1(AF),AL3(RECAFF) Fixed (binary)              @SC90037 07606340
  831.          DC    AL1(AM),AL3(RECLRC) LRECL                       @SC90037 07606360
  832.          DC    AL1(AV),AL3(RECAFD) V (binary)                  @SC90037 07606380
  833.          DC    AL1(00),AL3(RECRJC) ?                           @SC90037 07606400
  834. RECAFA   BAL   14,RECAMJ     Set it Text                       @SC90037 07606420
  835.          B     RECALP                                          @SC90037 07606440
  836. RECAFF   LA    4,AB          Plain old Binary                  @SC90037 07606460
  837. RECAFD   OI    FL1,BINF      Binary selected                   @SC90037 07606480
  838.          IC    4,ATOED(4)    Ok, set file type as well         @SC90037 07606500
  839.          STC   4,TYPFIL                                        @SC90037 07606520
  840. RECALP   BAL   14,RECSCN     Look for comma                    @SC90037 07606540
  841.          LA    6,1(,7)       Skip over comma for next piece    @SC90037 07606560
  842.          CR    6,5                                             @SC90037 07606580
  843.          BNL   RECCKL        Ran out of attribute stuff        @SC90037 07606600
  844.          B     RECAFM        Do next piece                     @SC90037 07606620
  845. RECLRC   BAL   14,RECSCN     Look for comma                    @SC90037 07606640
  846.          SR    7,6           Length of number string           @SC90037 07606660
  847.          LR    14,7          Convert number to EBCDIC          @SC90037 07606680
  848.          BNP   RECRJC        Impossible, reject it             @SC90037 07606700
  849.          BCTR  14,0                                            @SC90037 07606720
  850.          EX    14,RECTRAT                                      @SC90037 07606740
  851.          BAL   14,GETNUM     Get number                        @SC90037 07606760
  852.           B    RECRJC        Not proper numeric string         @SC90037 07606780
  853.          LTR   0,0           Validate LRECL                    @SC90037 07606800
  854.          BNP   RECRJC        No good                           @SC90037 07606820
  855.          STCM  0,3,FILLRC    Ok, use it                        @SC90037 07606840
  856.          B     RECALP        Look for another subattribute     @SC90037 07606860
  857. *          Length attribute                                    @SC90037 07606880
  858. RECALN   LTR   14,7          Copy length                       @SC88273 07607000
  859.          BNP   RECRJC        No good                           @SC88273 07607300
  860.          BCTR  14,0                                            @SC88273 07607600
  861.          EX    14,RECTRAT                                      @SC88273 07607900
  862.          BAL   14,GETNUM     Get file length                   @SC88273 07608200
  863.           B    RECRJC                                          @SC88273 07608500
  864.          ST    0,FILFSIZ     Save expected size                @SC90037 07609000
  865.          OPENF S,FILNAM,FILFDB,FILPTR,E=RECRJC Check disk space@SC90037 07610000
  866.          B     RECCKL        Ok, keep looking                  @SC86316 07612000
  867. RECTRAT  TR    0(,6),ATOED   Convert to EBCDIC for decoding    @SC88273 07612500
  868. *          Type attribute                                      @SC90037 07612508
  869. RECATP   BAL   2,RECALKP                                       @SC90037 07612516
  870.          DC    AL1(AA),AL3(RECATA) ASCII                       @SC90037 07612524
  871.          DC    AL1(AB),AL3(RECATB) Binary                      @SC90037 07612532
  872.          DC    AL1(00),AL3(RECRJC) Don't allow any other       @SC90037 07612540
  873. RECATA   BAL   14,RECAMJ     Set it Text                       @SC90037 07612548
  874.          B     RECCKL        Ok                                @SC90037 07612556
  875. RECATB   TM    FL1,BINF      Already binary?                   @SC90037 07612564
  876.          BO    RECCKL        Yes, that's fine                  @SC90037 07612572
  877.          OI    FL1,BINF      No, set it binary                 @SC90037 07612580
  878.          MVI   TYPFIL,C'B'   And choose simple binary          @SC90037 07612588
  879.          B     RECCKL                                          @SC90037 07612596
  880. *          Disposition attribute                               @SC90037 07612604
  881. RECADI   BAL   2,RECALKP                                       @SC90037 07612612
  882.          DC    AL1(AA),AL3(RECCKL) Archive (not implemented)   @SC90037 07612620
  883.          DC    AL1(AM),AL3(RECADM) Mail                        @SC90037 07612628
  884.          DC    AL1(AP),AL3(RECADP) Print                       @SC90037 07612636
  885.          DC    AL1(AS),AL3(RECADS) Submit as batch job         @SC90037 07612644
  886.          DC    AL1(00),AL3(RECRJC) unknown, reject             @SC90037 07612652
  887. *                                                                       07612660
  888. RECADM   LTR   7,7           Any recipients given?             @SC90037 07612668
  889.          BNP   RECRJC        No, that's bad                    @SC90037 07612676
  890.          BAL   2,RECAD1                                        @SC90037 07612684
  891.          DC    AL4(KMAIL1),AL2(L'KMAIL1,L'KMAIL2,L'KMAIL3)     @SC90037 07612692
  892. RECADP   BAL   2,RECAD1                                        @SC90037 07612700
  893.          DC    AL4(KPRNT1),AL2(L'KPRNT1,L'KPRNT2,L'KPRNT3)     @SC90037 07612708
  894. RECADS   BAL   2,RECAD1                                        @SC90037 07612716
  895.          DC    AL4(KSUBM1),AL2(L'KSUBM1,L'KSUBM2,L'KSUBM3)     @SC90037 07612724
  896. RECAD1   ICM   0,15,0(2)     Get prototype ptr                 @SC90037 07612732
  897.          LH    1,4(,2)       Get length of 1st piece           @SC90037 07612740
  898.          LA    14,CMD                                          @SC90037 07612748
  899.          ST    14,ADR        Save ptr to command buffer        @SC90037 07612756
  900.          ST    1,LEN         Save length of 1st piece          @SC90037 07612764
  901.          LR    15,1                                            @SC90037 07612772
  902.          MVCL  14,0          Copy first piece to buffer        @SC90037 07612780
  903.          ST    0,RECDSPTR    Save ptr to 2nd piece             @SC90037 07612788
  904.          LR    4,7           Save length of options            @SC90037 07612796
  905.          LA    0,FFDSP                                         @SC90037 07612804
  906.          LR    7,14          Feed output ptr to FSPEC          @SC90037 07612812
  907.          KCALL FSPEC,FILNAM  Copy filespec to buffer           @SC90037 07612820
  908.          LR    14,15         New output ptr                    @SC90037 07612828
  909.          LR    7,4           Retrieve option length            @SC90037 07612836
  910.          L     0,RECDSPTR    Get ptr to 2nd piece              @SC90037 07612844
  911.          LH    1,6(,2)       Get length of 2nd piece           @SC90037 07612852
  912.          LR    15,1                                            @SC90037 07612860
  913.          MVCL  14,0          Copy 2nd piece to buffer          @SC90037 07612868
  914.          LR    4,14          Save ptr to insert                @SC90037 07612876
  915.          LR    15,7                                            @SC90037 07612884
  916.          MVCL  14,6          Copy attribute stuff to buffer    @SC90037 07612892
  917.          TR    0(94,4),ATOED Convert to EBCDIC                 @SC90037 07612900
  918.          LH    1,8(,2)       Get length of 3rd piece           @SC90037 07612908
  919.          LR    15,1                                            @SC90037 07612916
  920.          MVCL  14,0          Copy 3nd piece to buffer          @SC90037 07612924
  921.          ST    14,RECDSPTR   Save ptr to end of command        @SC90037 07612932
  922.          OI    FL4,UCMD                                        @SC90037 07612940
  923.          KCALL SUPFNC,3,E=RECRJC Test if facility exists       @SC90037 07612948
  924.          B     RECCKL                                          @SC90037 07612956
  925. *                                                                       07613000
  926. *          Encoding attribute                                  @SC90037 07613100
  927. RECAEN   BAL   2,RECALKP                                       @SC90037 07613200
  928.          DC    AL1(AA),AL3(RECCKL) ASCII                       @SC90037 07613300
  929.          DC    AL1(AC),AL3(RECAEC) Special character set       @SC90040 07613350
  930.          DC    AL1(AE),AL3(RECATB) Binary                      @SC90037 07613400
  931.          DC    AL1(00),AL3(RECRJC) Don't allow any other       @SC90037 07613500
  932. *                                                                       07613600
  933. RECAEC   LTR   7,7                                             @SC90040 07613630
  934.          BNP   RECCKL        Character set not specified       @SC90040 07613660
  935.          KCALL TBLATT,E=RECRJC                                 @SC90040 07613690
  936.          B     RECCKL                                          @SC90040 07613720
  937. *                                                                       07613750
  938. RECRJL   MVC   REASON,RECLNCOD Because of length               @SC90037 07614000
  939. RECRJX   L     9,ASDATA      Output buffer                     @SC90037 07614100
  940.          MVI   0(9),AX       Reject this file                  @SC90033 07614300
  941.          MVC   DATL,F1                                         @SC90033 07614600
  942.          B     RECRJ2        Now accept only EOF pkt           @SC90033 07614900
  943. RECRJC   L     9,ASDATA      Output buffer                     @SC86316 07615200
  944.          MVI   0(9),AN       Mark it rejected                  @SC88273 07616000
  945.          TOCHR 0,REASON,1(9) Copy attribute code to response   @SC90037 07617000
  946.          MVC   DATL,F2       Data = 'N' + code                 @SC86316 07620300
  947. RECRJ2   DS    0H                                              @SC90033 07620600
  948.          OI    RFLG,RRJC     Mark it rejected                  @SC86316 07621000
  949.          BAL   2,SENDACKL    Acknowledge                       @SC86316 07623000
  950.          B     RECDAT        And wait for EOF                  @SC86316 07624000
  951. *                                                                       07625000
  952. RECEOF   TM    RFLG,RRJC     File rejected?                    @SC89218 07626000
  953.          BO    RECDISC       Yes, discard                      @SC89218 07626300
  954.          CLC   DATL,F1                                         @SC89218 07626600
  955.          BNE   RECWR                 One piece of data                  07627000
  956.          L     1,ARDATA                                        @SC86190 07628000
  957.          CLI   0(1),AD                                         @SC86190 07629000
  958.          BNE   RECWR                 Go if not discard                  07630000
  959. RECDISC  DS    0H                                              @SC89218 07630500
  960.          CLOSF FILPTR        Close the file                    @SC86135 07631000
  961.          TM    FILFLGS,APPN  Appending to old file?            @SC90033 07632000
  962.          BO    RECKEP        Yes, keep what we got             @SC86225 07633000
  963.          TM    FL1,KEEP                                        @SC90037 07634000
  964.          BO    RECKEP        Don't delete it anyway            @SC86225 07635000
  965.          ERASF FILNAM        And delete it                     @SC86295 07636000
  966. RECKEP   MVI   ERRNUM,ERRTRC Receive cancelled                 @SC86225 07637000
  967.          OI    RFLG,RTRC     Remember that                     @SC86295 07638000
  968.          B     RECACK                Pick up later on                   07639000
  969. * If data left in buffer when we get EOF, write remaining data.         07640000
  970. RECWR    ICM   1,15,WBUFL    Check length in buffer            @SC88120 07641000
  971.          BE    RECCLO                No data in WBUF, send Ack          07642000
  972.          KCALL OUTBUF,E=RECABR Write out buffer                         07643000
  973. RECCLO   CLOSF FILPTR        Close it                          @SC86135 07644000
  974.          MVI   ERRNUM,ERRNOE No error yet                      @SC88092 07644300
  975.          ICM   1,15,RECDSPTR Any special disposition?          @SC90037 07644330
  976.          BZ    RECACK                                          @SC90037 07644360
  977.          LA    14,CMD                                          @SC90037 07644390
  978.          ST    14,ADR        Save ptr to command buffer        @SC90037 07644420
  979.          SR    1,14          Get length of command             @SC90037 07644450
  980.          ST    1,LEN                                           @SC90037 07644480
  981.          OI    FL4,UCMD                                        @SC90037 07644510
  982.          KCALL SUPFNC,3,E=RECDSPX Disposition failed           @SC90037 07644540
  983. RECACK   KCALL ACCTNG        Save code in table                @SC89218 07644600
  984.          BAL   14,RECRSTA    Restore attributes                @SC90037 07644800
  985.          BAL   2,SENDACK     Send an ACK                       @SC89218 07645000
  986.          BAL   14,INCRSEQ                                               07646000
  987.          NI    FL1,255-ROVR          Only change first file             07647000
  988.          B     RECFIL                                                   07648000
  989. *                                                                       07649000
  990. RECBRK   MVI   ERRNUM,ERRTRC Receive cancelled?                @SC90033 07650000
  991.          TM    RFLG,RTRC+RRJC                                  @SC90033 07650200
  992.          BNZ   RECERP        Yes, send an error packet         @SC90033 07650400
  993.          TM    FL2,SRV       Server will read another command  @SC90033 07650600
  994.          BO    *+8            so don't zap write/read flag     @SC87343 07651000
  995.          MVI   WRRD,0        No read for Ack'ing BRK pkt       @SC87343 07652000
  996.          BAL   2,SENDACK             Send an ACK                        07653000
  997.          MVI   ERRNUM,ERRNOE Reset error                       @SC86156 07654000
  998.          B     RECRET                                          @SC89218 07658000
  999. *                                                                       07658200
  1000. RECDSPX  MVI   ERRNUM,ERRDSP Code for disposition failure      @SC90037 07658400
  1001.          B     RECABR                                          @SC90037 07658600
  1002. *                                                                       07659000
  1003. RECNER   LA    1,DSKSTT      Name error, point to dummy block  @SC88053 07662300
  1004.          MVC   FABCOMM-FABD(8,1),=CL8'Collisn'  Indicate type  @SC88053 07662600
  1005. RECRER   ERRF  ,             Cannot write. Analyze error       @SC87338 07663000
  1006. RECABR   CLOSF FILPTR        Close open file                   @SC86135 07664000
  1007.          KCALL ACCTNG        Save code in table                @SC88092 07664500
  1008.          BAL   14,RECRSTA    Restore attributes                @SC90037 07664700
  1009. RECERP   KCALL ERPACK        Send error packet                 @SC90033 07665000
  1010. RECRET   ICM   0,15,RECTRC   Any records truncated?            @SC87268 07666000
  1011.          LA    0,4           Indicate return from RECEIVE      @AB89191 07666500
  1012.          BZ    RETSNRC       None                              @SC87268 07667000
  1013.          CLI   ERRNUM,0                                        @SC87268 07668000
  1014.          BNE   *+8           Already got some (worse) error    @SC87268 07669000
  1015.          MVI   ERRNUM,ERRRTR Indicate error                    @SC87268 07670000
  1016.          B     RETSNRC       Close statistics and return       @SC87268 07671000
  1017. * Restore file attribute defaults from saved values            @SC90037 07671100
  1018. RECRSTA  XC    FL1,FL1SV     Restore flags                     @SC90037 07671200
  1019.          NI    FL1,255-BINF-REN-KEEP Restore only these flags  @SC90037 07671300
  1020.          XC    FL1,FL1SV                                       @SC90037 07671400
  1021.          MVC   TYPFIL,TYPFSV Restore file type                 @SC90037 07671500
  1022.          MVC   FILRCF,RCFSV  Restore record format             @SC90037 07671600
  1023.          MVC   FILLRC,LRCSV  Restore record length             @SC90037 07671700
  1024.          BR    14                                              @SC90037 07671800
  1025. * Receive mode Rpack interpret input tables                             07672000
  1026. RECINST  DC    AL1(AS),AL3(0)        Micro sent parm                    07673000
  1027.          DC    XL1'FF',AL3(RECABR)   Stop                      @SC88074 07673500
  1028.          DC    AL1(00),AL3(RECABR)   Error routine                      07674000
  1029. RECFNST  DC    AL1(AF),AL3(0)        Micro sent a filename              07675000
  1030.          DC    AL1(AX),AL3(0)        Micro sent a filename     @SC86155 07676000
  1031.          DC    AL1(AB),AL3(RECBRK)   Micro sent end of transaction      07677000
  1032.          DC    XL1'FF',AL3(RECABR)   Stop                      @SC88074 07677500
  1033.          DC    AL1(00),AL3(RECABR)   Error return                       07678000
  1034. RECANST  DC    AL1(AA),AL3(RECCKA)   Micro sent A-packet       @SC86316 07679000
  1035. RECDNST  DC    AL1(AD),AL3(0)        Micro sent data                    07680000
  1036. RECZNST  DC    AL1(AZ),AL3(RECEOF)   Micro sent EOF            @SC86316 07681000
  1037.          DC    XL1'FF',AL3(RECABR)   Stop                      @SC88074 07681500
  1038.          DC    AL1(00),AL3(RECABR)   Error return                       07682000
  1039.          LOCALS ,                                              @SC86295 07683000
  1040. RECDSPTR DS    F             Saved length of command           @SC90037 07683500
  1041. RFLG     DS    X             Local flags                       @SC86295 07684000
  1042. RTRC     EQU   X'80'         Other side cancelled              @SC86295 07685000
  1043. RRJC     EQU   X'40'         I cancelled                       @SC86316 07686000
  1044. FL1SV    DS    X             Saved global flags                @SC90037 07686200
  1045. TYPFSV   DS    C             Saved file type                   @SC90037 07686400
  1046. RCFSV    DS    C             Saved record format               @SC90037 07686600
  1047. LRCSV    DS    H             Saved record length               @SC90037 07686800
  1048. RECEIV   EXIT                                                           07687000
  1049.          TITLE 'ACCTNG Routine - save statistics for a transfer'        07687030
  1050. ACCTNG   ENTER                                                          07687060
  1051.          MVC   ERRLAST(2),ERRNUM Save error codes for file     @SC89218 07687070
  1052.          LM    2,3,DSKTOT    Current byte count                @SC88092 07687090
  1053.          SL    3,SSVDSK+4    Get difference from this file     @SC88092 07687120
  1054.          BC    3,*+6                                           @SC88092 07687150
  1055.           BCTR 2,0                                             @SC88092 07687180
  1056.          AL    3,=F'512'     Round up                          @SC88092 07687210
  1057.          BC    12,*+8                                          @SC88092 07687240
  1058.           AL   2,F1                                            @SC88092 07687270
  1059.          SL    2,SSVDSK                                        @SC88092 07687300
  1060.          SRDL  2,10          Convert to Kbytes                 @SC88092 07687330
  1061.          MVC   SSVDSK(8),DSKTOT                                @SC88092 07687360
  1062.          TS    ACCTFLG       See if file is current            @SC89218 07687370
  1063.          BNZ   RTRN0         No, do nothing                    @SC89218 07687380
  1064.          ICM   2,15,NSENT    Calculate offset into table       @SC88092 07687390
  1065.          BZ    RTRN          Must not be counting              @SC88092 07687420
  1066.          MH    2,FLFID1+2                                      @SC88092 07687450
  1067.          A     2,TSENT       Ptr to next name slot             @SC88092 07687480
  1068.          S     2,F5                                            @SC88092 07687510
  1069.          CLC   F0,0(2)       Already set?                      @SC88092 07687540
  1070.          BNE   RTRN          Yes, don't mess it up             @SC88092 07687570
  1071.          STCM  3,15,0(2)     Save file size in Kbytes          @SC88092 07687600
  1072.          MVC   4(1,2),ERRNUM Save error code for file          @SC88092 07687630
  1073.          B     RTRN0                                           @SC88306 07687640
  1074. *                                                                       07687643
  1075. * Copy file name from (R1) to file table, if possible; update count.    07687646
  1076. ACCTST   ENTER ALT                                             @SC88306 07687649
  1077.          MVI   ACCTFLG,0     Indicate file is current          @SC89218 07687650
  1078.          L     3,NSENT       Number of files sent so far       @SC88306 07687652
  1079.          LA    4,1(,3)       Incr number of sent files         @AB89191 07687655
  1080.          ST    4,NSENTAC     Number of files for acctng        @AB89191 07687656
  1081.          C     3,=A(MAXNSENT) Did we send more than countable? @SC88306 07687658
  1082.          BNL   RTRN0         Yes, cannot keep track of 'em     @SC88306 07687661
  1083.          MH    3,FLFID1+2    Times length of items             @SC88306 07687664
  1084.          A     3,TSENT       Loc in sent-table                 @SC88306 07687667
  1085.          MVC   0(LFID,3),0(1) Save fn ft sent                  @SC88306 07687670
  1086.          XC    LFID(5,3),LFID(3) Clear error code              @SC88306 07687673
  1087.          ST    4,NSENT       Keep it                           @SC88306 07687679
  1088.          B     RTRN0                                           @SC88306 07687682
  1089.          LOCALS ,                                              @SC88092 07687690
  1090. ACCTNG   EXIT  ,                                               @SC88092 07687720
  1091.          TITLE 'SPAR Routine - use parms from other host in DATA'       07688000
  1092. SPAR     ENTER                                                          07689000
  1093.          L     7,DATL        Data length                       @SC86120 07690000
  1094.          L     5,ARDATA      Point to data                     @SC86190 07691000
  1095.          LA    8,DEFPARM                                       @SC86190 07692000
  1096.          SR    8,5           Set up offset for defaults        @SC86190 07693000
  1097.          BCTR  5,0           Point one before data             @SC86190 07694000
  1098.          LA    6,1           Set up BXH                        @SC86120 07695000
  1099.          AR    7,5           Point to last data char           @SC86120 07696000
  1100.          BAL   14,SPARFTCH   Get a char                        @SC86120 07697000
  1101.          UNCHR 4             Max send packet size              @SC86120 07698000
  1102.          C     4,AKMIN       Less than min Kermit size?        @SC86295 07699000
  1103.          BNL   SPARSPM               No, it's OK                        07700000
  1104.          LA    4,KMIN                Else, use the min value            07701000
  1105. SPARSPM  C     4,AKMAX       More than max Kermit size?        @SC86295 07702000
  1106.          BNH   SPARSPS               No, it's OK                        07703000
  1107.          LA    4,KMAX                                                   07704000
  1108. SPARSPS  ST    4,SPSIZ               Save max send packet size          07705000
  1109.          BAL   14,SPARFTCH   Get a char                        @SC86120 07706000
  1110.          UNCHR 4,,TIMOUT     Timeout micro wants us to do      @SC86120 07707000
  1111.          BAL   14,SPARFTCH   Get a char                        @SC86120 07708000
  1112.          UNCHR 4,,SPADN      Pad count micro wants             @SC86120 07709000
  1113.          BAL   14,SPARFTCH                                     @SC86120 07710000
  1114.          CTL   4,,SPADC      Pad char micro wants              @SC86120 07711000
  1115.          BAL   14,SPARFTCH                                     @SC86120 07712000
  1116.          UNCHR 4,,SEOL       EOL char we have to use           @SC86120 07713000
  1117.          CLC   SEOL,SMARK                                               07714000
  1118.          BE    SPARCR                Use CR if EOL=MARK char            07715000
  1119.          CLI   SEOL,ABL                                                 07716000
  1120.          BL    SPAREOL2      OK if within ctl range            @SC87274 07717000
  1121. SPARCR   MVI   SEOL,CR               Send a CR to that crazy micro      07718000
  1122. SPAREOL2 MVC   S1EOL,SEOL    Make extra copy                   @SC87274 07719000
  1123. SPARCTL  BAL   14,SPARFTCH                                     @SC86120 07720000
  1124.          NOTQR *+8           Go if not 33-62 or 96-126         @SC86120 07721000
  1125.           LA   4,A#          Default ctl-quote                 @SC86120 07722000
  1126.          STC   4,RCTLQ       Save ctl-quote micro's using      @SC86120 07723000
  1127.          BAL   14,SPARFTCH                                     @SC86120 07724000
  1128.          CLI   EBQC,0                                          @SC87008 07725000
  1129.          BE    SPARNB        8-bit is off                      @SC87008 07726000
  1130.          CLM   4,1,=AL1(AY)                                    @SC86120 07727000
  1131.          BNE   *+8                                             @SC86120 07728000
  1132.          IC    4,EBQC        Micro agrees                      @SC86120 07729000
  1133.          BAL   14,SPARCKQX                                     @SC86120 07730000
  1134.           B    SPARNB        Micro says no 8-bit quoting       @SC86120 07731000
  1135.          CLI   EBQ,0                                                    07732000
  1136.          BE    SPAREBQ               Use it if we agree                 07733000
  1137.          CLM   4,1,EBQ                                         @SC86120 07734000
  1138.          BE    SPAREBQ               Or we match                        07735000
  1139. SPARNB   SR    4,4                   Otherwise cannot do it             07736000
  1140. SPAREBQ  STC   4,EBQ                 Set 8-bit-quoting char/flag        07737000
  1141.          BAL   14,SPARFTCH                                     @SC86120 07738000
  1142.          S     4,=A(A0)                                        @SC86120 07739000
  1143.          BNP   SPARBCD       Go if less than 1, use 1          @SC86120 07740000
  1144.          C     4,F3                                            @SC86295 07741000
  1145.          BH    SPARBCD               Go if over 3, use 1                07742000
  1146.          CLM   4,B'0001',BCTR        Requested and our BCT same?        07743000
  1147.          BE    SPARBCT               Yes, they are the same             07744000
  1148.          CLI   BCTR,0                                                   07745000
  1149.          BE    SPARBCT               We'll accept anything              07746000
  1150. SPARBCD  LA    4,1                   We don't match, use 1              07747000
  1151. SPARBCT  STC   4,BCTR                Micro's chksum length              07748000
  1152.          BAL   14,SPARFTCH                                     @SC86120 07749000
  1153.          BAL   14,SPARCKQX   See if valid                      @SC86120 07750000
  1154.           B    SPARNR        No good                           @SC86120 07751000
  1155.          CLM   4,1,EBQ                                         @SC86120 07752000
  1156.          BE    SPARNR                Go if same prefix                  07753000
  1157.          CLI   RPTQ,0                                                   07754000
  1158.          BE    SPARRQ                We can use anything                07755000
  1159.          CLM   4,1,RPTQ                                        @SC86120 07756000
  1160.          BE    SPARRQ                We match                           07757000
  1161. SPARNR   SR    4,4                   No repeat quoting                  07758000
  1162. SPARRQ   STC   4,RPTQ                Use negotiated repeat quote        07759000
  1163.          BAL   14,SPARFTCH   Get capabilities                  @SC86149 07760000
  1164.          UNCHR 4,,RCAPA                                        @SC86149 07761000
  1165.          TM    RCAPA,LONGP   Test for long packet bit          @TB86196 07762000
  1166.          BZ    SPARNX        No extended packets               @TB86196 07763000
  1167.          MVC   TMP,RCAPA                                       @SC86202 07764000
  1168. SPARNS1  TM    TMP,MORCAPAS  Test for more CAPAS bytes         @SC86202 07765000
  1169.          BZ    SPARNS2       No more                           @TB86196 07766000
  1170.          BAL   14,SPARFTCH   Get capabilities                  @TB86196 07767000
  1171.          UNCHR 4,,TMP                                          @TB86196 07768000
  1172.          B     SPARNS1                                         @TB86196 07769000
  1173. SPARNS2  BAL   14,SPARFTCH   Skip window byte                  @SC86202 07770000
  1174.          BAL   14,SPARFTCH   Get next header byte              @TB86196 07771000
  1175.          LR    1,4                                             @TB86196 07772000
  1176.          UNCHR 1             MAXLX1 byte                       @TB86196 07773000
  1177.          MH    1,XLFCT+2     Times the factor                  @SC86202 07774000
  1178.          BAL   14,SPARFTCH   Get next header byte              @TB86196 07775000
  1179.          UNCHR 4             MAXLX2 byte                       @TB86196 07776000
  1180.          AR    1,4           Compute total length              @TB86196 07777000
  1181.          BNP   SPARNX        If zero, use default              @TB86196 07778000
  1182.          ST    1,SPSIZ       New SPSIZ for extended            @TB86196 07779000
  1183. SPARNX   DS    0H                                              @TB86196 07780000
  1184. * Now compute MAXSIZ                                                    07781000
  1185.          L     5,SPSIZ               Maximum send packet size           07782000
  1186.          C     5,AKMAX       Check max packet size             @TB86196 07783000
  1187.          BNH   SPARNY        Not long                          @TB86196 07784000
  1188.          CLI   TRMTP,C'V'                                      @SC89020 07785300
  1189.          BE    *+12          TTY ==> limited                   @SC89020 07785600
  1190.          CLI   TRMTP,C'T'                                      @SC87166 07786000
  1191.          BNE   SPAREHL       Not TTY ==> not limited           @SC90010 07787000
  1192.          C     5,AMAXWT                                        @SC86205 07788000
  1193.          BNH   *+8                                             @SC86205 07789000
  1194.          L     5,AMAXWT      Biggest we can send               @SC86205 07790000
  1195. SPAREHL  S     5,F3          Extended header length            @SC90010 07790200
  1196.          CLI   S1HND,0                                         @SC90010 07790400
  1197.          BE    SPARNY        Ok, no handshake                  @SC90010 07790600
  1198.          BCTR  5,0           Deduct one for handshake          @SC90010 07790800
  1199. SPARNY   DS    0H                                              @SC86205 07791000
  1200.          S     5,F5                  Minus control information          07792000
  1201.          IC    4,BCTR                Get user's negotiated BCT          07793000
  1202.          SR    5,4                   Minus checksum length              07794000
  1203.          CLI   EBQ,0                                                    07795000
  1204.          BE    SPARNEBQ              Go if no 8-Bit quoting             07796000
  1205.          BCTR  5,0                   Another one for 8-bit quoting      07797000
  1206. SPARNEBQ CLI   RPTQ,0                                                   07798000
  1207.          BE    SPARNRQ               Go if no repeat char quoting       07799000
  1208.          BCTR  5,0                                                      07800000
  1209.          BCTR  5,0                   Minus two for repeat prefix        07801000
  1210. SPARNRQ  ST    5,MAXSIZ              Save max length for data field     07802000
  1211.          ST    5,MAXSIZ+4    Static extra copy (for tuning)             07803000
  1212. SPARBAK  RET                                                   @SC86152 07804000
  1213. SPARCKQX CLM   4,1,RCTLQ                                       @SC86120 07805000
  1214.          BER   14            Cannot use same prefix            @SC86120 07806000
  1215.          CLM   4,1,SCTLQ                                       @SC86120 07807000
  1216.          BER   14                                              @SC86120 07808000
  1217.          B     CHKQR         Test if 33-62 or 96-126           @SC86120 07809000
  1218. SPARFTCH L     4,SPACE       Default                           @SC86120 07810000
  1219.          BXH   5,6,*+8       Check for more data               @SC86120 07811000
  1220.          IC    4,0(5)        OK, use it                        @SC86120 07812000
  1221.          C     4,SPACE       Default?                          @SC86120 07813000
  1222.          BNER  14                                              @SC86120 07814000
  1223.          IC    4,0(5,8)      Yes, get default value            @SC86190 07815000
  1224.          BR    14                                              @SC86120 07816000
  1225. *                                                                       07817000
  1226. *        SPARSET Routine - set up for exchange (SPAR 1st)      @SC86152 07818000
  1227. *                                                                       07819000
  1228. SPARSET  ENTER ALT                                             @SC86152 07820000
  1229.          MVI   BCTR,0        Use whatever micro wants          @SC86152 07821000
  1230.          MVI   EBQ,0                                           @SC86152 07822000
  1231.          MVI   RPTQ,0                                          @SC86152 07823000
  1232.          MVI   BCTU,1        Must start at 1                   @SC86295 07824000
  1233.          B     SPARBAK                                         @SC86152 07825000
  1234.          LOCALS ,                                              @SC86295 07826000
  1235. SPAR     EXIT                                                           07827000
  1236.          TITLE 'RPAR Routine - sets up parms to send to other host'     07828000
  1237. RPAR     ENTER                                                          07829000
  1238.          OI    FL3,PXCH      Parameters exchanged now          @SC87012 07830000
  1239.          L     9,ASDATA                                        @SC86295 07831000
  1240.          TOCHR 5,RPSIZ+3,0(9)  Receive packet size limit       @SC86295 07832000
  1241.          TOCHR 5,RTIMO,1(9)  Time limit for micro to wait      @SC86295 07833000
  1242.          TOCHR 5,RPADN,2(9)  Number of padding chars.          @SC86295 07834000
  1243.          CTL   5,RPADC,3(9)  Pad character                     @SC86295 07835000
  1244.          TOCHR 5,REOL,4(9)   EOL char I need                   @SC86295 07836000
  1245.          MVC   5(1,9),SCTLQ                                    @SC86295 07837000
  1246.          MVC   6(1,9),EBQ                                      @SC86295 07838000
  1247.          CLI   EBQ,0                                                    07839000
  1248.          BNE   RPARBCT               It's OK if not null                07840000
  1249.          MVI   6(9),AN       Else, use an N                    @SC86295 07841000
  1250. RPARBCT  MVC   7(1,9),BCTR   Negotiated checksum               @SC86295 07842000
  1251.          OI    7(9),A0       Make into a real digit            @SC86295 07843000
  1252.          MVC   8(1,9),RPTQ                                     @SC86295 07844000
  1253.          CLI   RPTQ,0                                                   07845000
  1254.          BNE   *+8           It's ok if not null               @SC86149 07846000
  1255.          MVI   8(9),ABL      Else, use a blank                 @SC86295 07847000
  1256.          LA    0,10          Size of data                      @SC86149 07848000
  1257.          NI    SCAPA,255-LONGP No long packets                 @TB86196 07849000
  1258.          LA    5,KMAX        Largest old KERMIT size           @TB86196 07850000
  1259.          C     5,RPSIZ       Check max packet size             @TB86196 07851000
  1260.          BNL   RPARNEX       KMAX >= RPSIZ                     @TB86196 07852000
  1261.          TOCHR 5,,0(9)       Set largest packet size           @SC86295 07853000
  1262.          OI    SCAPA,LONGP   Long packets                      @TB86196 07854000
  1263.          MVI   10(9),ABL     Window size is blank              @SC86295 07855000
  1264.          L     5,RPSIZ       Packet size                       @SC86205 07856000
  1265.          CLI   TRMTP,C'V'                                      @SC89020 07856300
  1266.          BE    *+12          TTY ==> limited                   @SC89020 07856600
  1267.          CLI   TRMTP,C'T'                                      @SC87166 07857000
  1268.          BNE   RPARS1        Not TTY ==> not limited           @SC87166 07858000
  1269.          C     5,AMAXRT                                        @SC86205 07859000
  1270.          BNH   *+8                                             @SC86205 07860000
  1271.          L     5,AMAXRT      Biggest we can send               @SC86205 07861000
  1272. RPARS1   SR    4,4                                             @SC86205 07862000
  1273.          D     4,XLFCT       Compute extended size bytes       @TB86196 07863000
  1274.          TOCHR 5,,11(9)      Extended size 1                   @SC86295 07864000
  1275.          TOCHR 4,,12(9)      Extended size 2                   @SC86295 07865000
  1276.          LA    0,13          Size of data                      @TB86196 07866000
  1277. RPARNEX  DS    0H                                              @TB86196 07867000
  1278.          TOCHR 5,SCAPA,9(9)  Capabilities                      @SC86295 07868000
  1279.          ST    0,DATL        Return it                         @SC86149 07869000
  1280.          LA    0,3           Reset function                    @SC86295 07870000
  1281.          CLI   TRMTP,C'V'                                      @SC88323 07870300
  1282.          BE    RPARSTT       VTAM TTY                          @SC88323 07870600
  1283.          CLI   TRMTP,C'T'                                      @SC87166 07873000
  1284.          BE    RPARSTT       TTY                               @SC87166 07874000
  1285.          KCALL SCRNIO                                          @SC86295 07875000
  1286.          B     RPARBAK                                         @SC86295 07876000
  1287. RPARSTT  KCALL TERMIO                                          @SC86295 07877000
  1288. RPARBAK  RET                                                   @SC86152 07878000
  1289. *                                                                       07879000
  1290. *        RPARSET Routine - set up for exchange (RPAR 1st)      @SC86152 07880000
  1291. *                                                                       07881000
  1292. RPARSET  ENTER ALT                                             @SC86152 07882000
  1293.          MVI   BCTU,1        Must start at 1                   @SC86295 07883000
  1294.          TM    FL2,SRV       Possible I-packet exchange?       @SC87169 07884000
  1295.          BZ    RPSCLR        Not in Server mode                @SC87169 07885000
  1296.          TM    FL3,PXCH      Any exchange since last SET?      @SC87169 07886000
  1297.          BO    RPARBAK       Yes, keep latest settings         @SC87169 07887000
  1298. RPSCLR   MVC   BCTR,BCTC     Use what user set                 @SC87169 07888000
  1299.          MVC   EBQ,EBQC      Set what we want otherwise        @SC86152 07889000
  1300. RPSEBQ   CLI   RPTQ,0                                          @SC86152 07890000
  1301.          BNE   RPARBAK       If RPTQ is set leave it alone     @SC86152 07891000
  1302.          MVC   RPTQ,RPTQC    Set what we want otherwise        @SC86152 07892000
  1303.          B     RPARBAK                                         @SC86152 07893000
  1304.          LOCALS ,                                              @SC86295 07894000
  1305. RPAR     EXIT                                                           07895000
  1306.          TITLE 'ENCODE Routine - encode pkts from RBUF into DATA'       07896000
  1307. ENCODE   ENTER                                                          07897000
  1308.          L     6,MAXSIZ                                        @SC86295 07898000
  1309.          L     9,ASDATA      Pointer to data to fill           @SC86190 07899000
  1310.          AR    6,9           Limit on output                   @SC86295 07900000
  1311. ENCAGAIN L     8,RBUFP               Index of next char in RBUF         07901000
  1312.          L     5,RBUFL       Data length in RBUF               @SC86163 07902000
  1313.          L     1,RBUF                Point to start of buffer           07903000
  1314.          AR    5,1                   Point to char after last one       07904000
  1315.          AR    8,1           Point to char to encode           @SC86163 07905000
  1316. ENCNXT   CR    8,5           Are we past the last char?        @SC86163 07906000
  1317.          BL    ENCPKT        No, not exhausted RBUF yet        @SC86163 07907000
  1318.          TM    FL1,NAME                                        @SC86163 07908000
  1319.          BO    ENCEMPT       No more disk read if file name    @SC86163 07909000
  1320.          KCALL INBUF,E=ENCRET                                  @SC86163 07910000
  1321.          B     ENCAGAIN                                        @SC86163 07911000
  1322. ENCPKT   CLI   RPTQ,0                                                   07912000
  1323.          BE    ENCEBQ                Go if no repeat quoting            07913000
  1324.          LA    14,3(8)       Point to 3 chars past current     @SC86163 07914000
  1325.          CR    14,5          Is this past the last char?       @SC86163 07915000
  1326.          BNL   ENCEBQ                Yes, not enough to use repeat      07916000
  1327.          CLC   0(2,8),1(8)   At least 3 of these?              @SC86163 07917000
  1328.          BNE   ENCEBQ        No, not enough                    @SC86163 07918000
  1329.          LR    2,8           Start of string                   @SC86163 07919000
  1330.          LA    3,KMAX(8)     Max allowed by notation           @SC86163 07920000
  1331.          CR    3,5           Watch for end of data             @SC86163 07921000
  1332.          BNH   *+6                                             @SC86163 07922000
  1333.          LR    3,5           Truncate at max                   @SC86163 07923000
  1334.          LR    15,3          Same limit                        @SC86163 07924000
  1335.          SR    3,2           Get lengths                       @SC86163 07925000
  1336.          SR    15,14         Length of shorter string          @SC86163 07926000
  1337.          ICM   15,8,0(8)     Use starting char for fill        @SC86163 07927000
  1338.          CLCL  2,14          Find end of match                 @SC86163 07928000
  1339.          SR    14,8          Get repeat count                  @SC86163 07929000
  1340.          AR    8,14          Advance ptr to                    @SC86163 07930000
  1341.          BCTR  8,0             last matching char              @SC86163 07931000
  1342.          MVC   0(1,9),RPTQ   Put repeat quote into DATA        @SC86163 07932000
  1343.          TOCHR 14,,1(9)                                        @SC86163 07933000
  1344.          LA    9,2(9)        Count 2 for RPTQ and rpt count    @SC86295 07934000
  1345. ENCEBQ   TM    0(8),128                                        @SC86163 07935000
  1346.          BZ    ENCCTL                no 8th bit                         07936000
  1347.          CLI   EBQ,0                                                    07937000
  1348.          BNE   ENC8B         Can use 8bit quoting, do it       @SC89072 07938090
  1349.          TM    SPRTY,DAT8    Can't: see if 8-bit channel       @SC89072 07938180
  1350.          BO    ENCCTL        Yes, that's ok too                @SC89072 07938270
  1351.          MVI   ERRNUM,ERRPTY No, can't send this byte!         @SC89072 07938360
  1352.          LA    15,1                                            @SC89072 07938450
  1353.          B     ENCRET        Save length, in case ERPACK loop  @SC89072 07938540
  1354. ENC8B    DS    0H                                              @SC89072 07938630
  1355.          NI    0(8),127      Get rid of 8th bit                @SC86163 07939000
  1356.          MVC   0(1,9),EBQ            Move EBQ into DATA                 07940000
  1357.          LA    9,1(9)        Count for it                      @SC86295 07941000
  1358. ENCCTL   IC    7,0(8)        Load desired char                 @SC86163 07942000
  1359.          CLI   0(8),ABL                                        @SC86163 07943000
  1360.          BL    ENCSCTL               within control range               07944000
  1361.          CLI   0(8),ADEL                                       @SC86163 07945000
  1362.          BNE   ENCNCTL               not a control char                 07946000
  1363. ENCSCTL  CTL   7             Convert to non-control            @SC86163 07947000
  1364.          B     ENCMVCTL                                                 07948000
  1365. *                                                                       07949000
  1366. ENCNCTL  CLM   7,1,SCTLQ                                       @SC86163 07950000
  1367.          BE    ENCMVCTL              send prefix if ctl quote char      07951000
  1368.          CLM   7,1,EBQ                                         @SC86163 07952000
  1369.          BE    ENCMVCTL              ditto if 8bit quote                07953000
  1370.          CLM   7,1,RPTQ                                        @SC86163 07954000
  1371.          BNE   ENCNOCTL              not so if not repeat quote         07955000
  1372. ENCMVCTL MVC   0(1,9),SCTLQ          Move a ctl quote                   07956000
  1373.          LA    9,1(9)                incr for it                        07957000
  1374. ENCNOCTL STC   7,0(9)        Move the char, finally!           @SC86163 07958000
  1375.          LA    9,1(9)                incr for it                        07959000
  1376.          LA    8,1(8)        Incr RBUF pointer                 @SC86163 07960000
  1377.          CR    9,6           Did we reach max pkt size?        @SC86295 07961000
  1378.          BL    ENCNXT        Test for more data                @SC86295 07962000
  1379. *                                                                       07963000
  1380. ENCFULL  CR    8,5           Are we past the last char?        @SC86163 07964000
  1381.          BL    ENCGOOD       No, not exhausted RBUF data yet   @SC86163 07965000
  1382. ENCEMPT  XC    RBUFL,RBUFL   Zap data length for next time     @SC86163 07966000
  1383. ENCGOOD  SR    15,15                                                    07967000
  1384.          S     8,RBUF        Get current index                 @SC86163 07968000
  1385.          ST    8,RBUFP               Save RBUF index                    07969000
  1386. ENCRET   S     9,ASDATA      Get length                        @SC86295 07970000
  1387.          ST    9,DATL        Save encoded DATA length          @SC86295 07971000
  1388.          RET   ,                                               @SC86295 07972000
  1389.          LOCALS ,                                              @SC86295 07973000
  1390. ENCODE   EXIT                                                           07974000
  1391.          TITLE 'NPREAD Routine - copy from RBUF to SDATA'      @HF86150 07975000
  1392. NPREAD   ENTER                                                 @HF86150 07976000
  1393.          L     6,SPSIZ       Max packet length                 @SC86295 07977000
  1394.          LR    4,6           Save                              @SC86295 07978000
  1395.          L     9,ASPKT       Fill pointer (includes header)    @SC86165 07979000
  1396.          SR    7,7                                             @SC86165 07980000
  1397.          IC    7,TCTLQ       Fetch control quote               @SC86165 07981000
  1398. NPRAGAIN L     8,RBUFP       Index of next char in RBUF        @SC86165 07982000
  1399.          L     5,RBUFL       Data length in RBUF               @SC86165 07983000
  1400.          L     1,RBUF        Start of buffer                   @SC86165 07984000
  1401.          AR    5,1           Point to char after last one      @SC86165 07985000
  1402.          AR    8,1           Point to char to encode           @SC86165 07986000
  1403. NPRNXT   CR    8,5           Are we past the last char?        @SC86165 07987000
  1404.          BL    NPRTCT        No, not exhausted RBUF yet        @SC86165 07988000
  1405. NPRRD    KCALL INBUF,E=NPRRET                                  @HF86150 07989000
  1406.          B     NPRAGAIN                                        @SC86165 07990000
  1407. NPRTCT   LTR   7,7           Test for quoting                  @SC86165 07991000
  1408.          BZ    NPRNOCTL      Not enabled                       @HF86150 07992000
  1409.          CLM   7,1,0(8)      Is it a quote character?          @HF86150 07993000
  1410.          BNE   NPRNOCTL      No, copy it                       @HF86150 07994000
  1411.          LA    8,1(8)        Check next                        @HF86150 07995000
  1412.          CR    8,5                                             @HF86150 07996000
  1413.          BNL   NPRRD         Ran out of data, ignore the quote @HF86150 07997000
  1414.          CLM   7,1,0(8)      If repeat of quote character      @HF86150 07998000
  1415.          BE    NPRNOCTL       send that character              @HF86150 07999000
  1416.          NI    0(8),X'1F'    Make control character            @HF86150 08000000
  1417. NPRNOCTL MVC   0(1,9),0(8)   Copy the char                     @HF86150 08001000
  1418.          LA    9,1(9)        Incr for it                       @HF86150 08002000
  1419.          LA    8,1(8)        Incr RBUF pointer                 @HF86150 08003000
  1420.          BCT   6,NPRNXT      Get next character if any room    @SC86295 08004000
  1421. *                                                                       08005000
  1422. NPRGOOD  SR    15,15                                           @HF86150 08006000
  1423.          S     8,RBUF        Convert to index                  @SC86165 08007000
  1424.          ST    8,RBUFP       Save it                           @SC86165 08008000
  1425. NPRRET   SR    4,6           Get DATA length                   @SC86295 08009000
  1426.          ST    4,SNDPKL      Save it                           @HF86150 08010000
  1427.          RET                                                   @HF86150 08011000
  1428.          LOCALS ,                                              @SC86295 08012000
  1429. NPREAD   EXIT                                                  @HF86150 08013000
  1430.          TITLE 'DECODE Routine - decode pkts from DATA to WBUF'         08014000
  1431. * Exit: ERRNUM left unchanged unless there is an error.                 08014500
  1432. DECODE   ENTER                                                          08015000
  1433.          ICM   5,B'1111',DATL        Data length to decode              08016000
  1434.          BNP   RTRN1         No data to decode                 @SC86295 08017000
  1435.          TM    FL1,EOF                                                  08018000
  1436.          BO    DECNULL               Ignore if ctl-z caused EOF         08019000
  1437.          L     1,WBUF                Point to output buffer             08020000
  1438.          L     9,WBUFL               Number of chars in it              08021000
  1439.          AR    1,9                   Point to next spot to fill         08022000
  1440.          L     8,ARDATA      Data to be decoded                @SC86190 08023000
  1441.          AR    5,8           Point one past the last char               08024000
  1442. DECLOOP  LA    3,1           Repeat count                      @SC86316 08025000
  1443.          CLI   RPTQ,0                                                   08026000
  1444.          BE    DECEBQ                Not doing repeats                  08027000
  1445.          CLC   RPTQ,0(8)                                                08028000
  1446.          BNE   DECEBQ                Not the repeat quote               08029000
  1447.          UNCHR 3,1(8)        Get number of repeats             @SC86316 08030000
  1448.          LA    8,2(8)                skip to char to decode             08031000
  1449. DECEBQ   MVI   CUR,0                 No 8th bit yet                     08032000
  1450.          CLI   EBQ,0                                                    08033000
  1451.          BE    DECCTL                Not doing 8bit quoting             08034000
  1452.          CLC   EBQ,0(8)                                                 08035000
  1453.          BNE   DECCTL                Not the 8bit quote                 08036000
  1454.          LA    8,1(8)                point to char to decode            08037000
  1455.          MVI   CUR,128               8th bit seen                       08038000
  1456. DECCTL   CLC   RCTLQ,0(8)                                               08039000
  1457.          BNE   DECCHR                not the ctl quote                  08040000
  1458.          LA    8,1(8)                point to char to decode            08041000
  1459.          CLI   0(8),63                                                  08042000
  1460.          BL    DECCHR                skip if not in ctl range           08043000
  1461.          CLI   0(8),95                                                  08044000
  1462.          BH    DECCHR                skip if not in ctl range           08045000
  1463.          CTL   4,0(8),0(8)           Ctl it                             08046000
  1464. DECCHR   OC    0(1,8),CUR            put in the parity                  08047000
  1465.          MVC   CUR,0(8)              move it here also                  08048000
  1466. DECRLOOP TM    FL1,NAME                                                 08050000
  1467.          BO    DECPUT                skip if not writing to disk        08051000
  1468.          LTR   7,9           Started yet?                      @SC86316 08052000
  1469.          BZ    DECTFUL       No                                @SC86151 08053000
  1470.          C     9,RDWLEN                                        @SC86151 08054000
  1471.          BNE   DECTFUL                                         @SC86151 08055000
  1472.          L     6,WBUF        Just finished RDW                 @SC86316 08056000
  1473.          SR    14,14                                           @SC86151 08057000
  1474.          ICM   14,3,0(6)     Get expected length               @SC86316 08058000
  1475.          C     9,F2          Short?                            @SC86262 08059000
  1476.          BE    DECVLEN       Yes, we got it                    @SC86262 08060000
  1477.          TR    0(5,6),ATOED  No, must be 5-byte ASCII prefix   @SC89301 08061000
  1478.          MVI   ERRNUM,ERRBPC Look out for bad field            @SC86262 08062000
  1479.          BAL   14,GETNUM     Read length field                 @SC86316 08063000
  1480.           B    RTRN1         Bad                               @SC86316 08064000
  1481.          LR    14,0                                            @SC86316 08065000
  1482. DECVLEN  DS    0H                                              @SC86262 08066000
  1483.          AR    14,9               + RDW length                 @SC86151 08067000
  1484.          ST    14,MAXOUT     Reset byte limit                  @SC86151 08068000
  1485. DECTFUL  C     9,MAXOUT      Max write buffer size reached?    @SC86151 08069000
  1486.          BL    DECMORE       No, keep appending                @SC88120 08070000
  1487.          KCALL OUTBUF,(9),E=RTRN1 Yes, write buffer            @SC88120 08070080
  1488.          SR    9,9           Reset count and output pointer    @SC88120 08070160
  1489.          L     1,WBUF                                          @SC88120 08070240
  1490.          TM    FL1,BINF                                        @SC88120 08070320
  1491.          BO    DECPUT        Binary always folds, no problem   @SC88120 08070400
  1492.          CLI   CUR,CR        Exactly full just in time?        @SC88120 08070480
  1493.          BE    DECIGN        Yes, don't create empty line      @SC88120 08070560
  1494.          LA    0,1           Other, this is called folding     @SC88120 08070640
  1495.          A     0,RECFLD                                        @SC88120 08070720
  1496.          ST    0,RECFLD                                        @SC88120 08070800
  1497.          B     DECPUT        Ok, now copy the new character    @SC88120 08070880
  1498. DECMORE  TM    FL1,BINF                                                 08071000
  1499.          BO    DECPUT                No special test in binary mode     08072000
  1500.          CLI   CUR,CR                                                   08073000
  1501.          BE    DECWRT                A cr means end of record           08074000
  1502.          CLI   CUR,ALF                                         @SC89301 08075000
  1503.          BNE   DECTAB                Not an LF                          08076000
  1504.          CLI   PREV,CR                                                  08077000
  1505.          BE    DECIGN                A cr/lf together = ignre the LF    08078000
  1506. DECWRT   KCALL OUTBUF,(9),E=RTRN1 Write buffer                 @SC88120 08080000
  1507.          SR    9,9                   Reset length to resume decoding    08081000
  1508.          L     1,WBUF                Reset pointer also                 08082000
  1509.          B     DECIGN                                                   08085000
  1510. *                                                                       08086000
  1511. DECTAB   TM    FL2,TABS                                                 08087000
  1512.          BZ    DECCTLZ               Skip if not expanding tabs         08088000
  1513.          CLI   CUR,AHT                                         @SC89301 08089000
  1514.          BNE   DECCTLZ               Not a tab                          08090000
  1515.          LR    0,1           Save output ptr                   @SC86355 08091000
  1516.          LH    2,TABCNT      Get count of tabs that are set    @TS86100 08092000
  1517.          LTR   2,2           Any?                              @SC86355 08093000
  1518.          BZ    DECTL8        No, use every 8 cols              @SC86355 08094000
  1519.          LA    7,TABTBL      Yes, point to table of tabs       @TS86100 08095000
  1520.          SR    1,1                                             @TS86100 08096000
  1521. DECTLP   IC    1,0(7)        Get tab column from table         @TS86100 08097000
  1522.          BCTR  1,0           Adjust for displacement compare   @TS86100 08098000
  1523.          CR    1,9           Where is this tab compared to buf @TS86100 08099000
  1524.          BH    DECTLX        Above buffer position             @TS86100 08100000
  1525.          LA    7,1(7)        Point to next tab position        @TS86100 08101000
  1526.          BCT   2,DECTLP      Continue with next tab            @TS86100 08102000
  1527. DECTL8   DS    0H                                              @SC86355 08103000
  1528.          LA    1,8(9)        Buffer pointer + 8                @SC86355 08104000
  1529.          SRL   1,3                                             @SC86355 08105000
  1530.          SLL   1,3           Round up to multiple of 8         @SC86355 08106000
  1531. DECTLX   C     1,MAXLRC                                        @SC86355 08107000
  1532.          BL    *+8                                             @SC86355 08108000
  1533.          L     1,MAXLRC      Don't go past end of buffer       @SC86355 08109000
  1534.          SR    1,9           Number of blanks to add           @SC86355 08110000
  1535.          AR    9,1           Advance the count                 @SC86355 08111000
  1536.          LA    15,ABL                                          @SC86355 08112000
  1537.          SLL   15,24         Set for ASCII blank fill          @SC86355 08113000
  1538.          MVCL  0,14          Jump to tab stop                  @SC86355 08114000
  1539.          LR    1,0           Restore output ptr                @SC86355 08115000
  1540.          B     DECIGN                skip to the end of this            08116000
  1541. *                                                                       08117000
  1542. DECCTLZ  TM    FL2,EOFZ                                                 08118000
  1543.          BZ    DECPUT                Skip if EOF is off                 08119000
  1544.          CLI   CUR,ASUB                                        @SC89301 08120000
  1545.          BNE   DECPUT                Skip if not a ctl-z                08121000
  1546.          OI    FL1,EOF               Fake an end-of-file                08122000
  1547.          B     DECEOF                all done                           08123000
  1548. *                                                                       08124000
  1549. DECPUT   C     9,MAXLRC      Still within disk buffer?         @SC86355 08125000
  1550.          BNL   *+10          No, don't copy                    @SC86355 08126000
  1551.          MVC   0(1,1),0(8)   Yes, put the data in buffer       @SC86355 08127000
  1552.          LA    9,1(9)                Increment count                    08128000
  1553.          LA    1,1(1)                Increment pointer                  08129000
  1554. DECIGN   MVC   PREV,CUR              copy the decoded char              08130000
  1555.          BCT   3,DECRLOOP    Repeat it repeat count times      @SC86316 08131000
  1556.          LA    8,1(8)                Increment decoded data pointer     08132000
  1557.          CR    8,5                   Did we reach end of DATA?          08133000
  1558.          BL    DECLOOP               No, More data left to decode       08134000
  1559. DECEOF   ST    9,WBUFL               Save buffer length                 08135000
  1560. DECNULL  B     RTRN0         Good return code                  @SC86295 08136000
  1561.          LOCALS ,                                              @SC86295 08137000
  1562. CUR      DS    C             Char being decoded                @SC86295 08138000
  1563. DECODE   EXIT                                                           08139000
  1564.          TITLE 'ERPACK Routine - send error packet with errnum'         08140000
  1565. ERPACK   ENTER                                                          08141000
  1566.          CLI   ERRNUM,ERRABO                                   @SC86295 08142000
  1567.          BE    RTRN0         Skip it if the micro died         @SC86295 08143000
  1568.          MVI   STYPE,AE              Error packet                       08146000
  1569.          MVC   SEQ,RSN               Synch packet numbers               08147000
  1570.          SR    5,5                                                      08148000
  1571.          IC    5,ERRNUM              Get right message number           08149000
  1572.          SLL   5,2           Pointer offset = ERRNUM * 4       @SC86156 08150000
  1573.          A     5,=A(ERRTAB)  Pointer address                   @SC89215 08151000
  1574.          L     3,0(5)        Msg ptr                           @SC86156 08152000
  1575.          SR    4,4                                             @SC86156 08153000
  1576.          IC    4,0(5)        Msg length                        @SC86156 08154000
  1577.          TM    FL2,PROTO                                       @SC87300 08155000
  1578.          BZ    RTRN0         Skip packet if never started      @SC87300 08156000
  1579.          TM    FL2,SRV       Server will read another command  @SC87343 08157000
  1580.          BO    *+8            so don't zap write/read flag     @SC87343 08158000
  1581.          MVI   WRRD,0        No read ncessary for Err pkt      @SC87300 08159000
  1582.          ST    4,RBUFL       Save length to encode             @SC86156 08160000
  1583.          L     1,RBUF                                                   08161000
  1584.          MVC   0(50,1),0(3)  Put data in RBUF (and some extra) @SC86156 08162000
  1585.          TR    0(50,1),ETOAD ASCII it                          @SC89301 08163000
  1586.          LA    8,F0          Point to null list                @SC89072 08163500
  1587.          BAL   9,ENCODEN                                       @SC86295 08164000
  1588.          KCALL SPACK         Send error packet                 @SC86135 08165000
  1589.          RET                                                            08166000
  1590.          LOCALS ,                                              @SC86295 08167000
  1591. ERPACK   EXIT                                                           08168000
  1592.          TITLE 'SPACK Routine - sends DATA buffer'                      08169000
  1593. SPACK    ENTER                                                          08170000
  1594.          SR    3,3                   Zero out IC register               08171000
  1595.          L     8,AASPKT      SNDPKT address                    @SC86295 08172000
  1596. SPKNX3   LA    8,3(8)        Remove LX1, LX2, HCHECK from hdr  @SC86295 08173000
  1597.          L     9,DATL                Data size                          08174000
  1598.          IC    3,BCTU                CHK len                            08175000
  1599.          LA    9,2(3,9)              Data, CHK, SEQ, TYP lengths        08176000
  1600.          LA    1,3(9)        Plus SOH, LEN, EOL lengths        @SC86202 08177000
  1601.          C     9,AKMAX       Check packet length byte          @SC86202 08178000
  1602.          BNH   SPKNXDL1      No extended data len              @SC86202 08179000
  1603.          LA    1,3(1)        Plus LX1,LX2,HCHECK for ext. hdr  @SC86202 08180000
  1604.          SR    9,9           Set 'Type 0' extended hdr         @SC86202 08181000
  1605.          SH    8,SPKNX3+2    Remove LX1, LX2, HCHECK from hdr  @SC86295 08182000
  1606. SPKNXDL1 ST    1,SNDPKL      SNDPKT length                     @SC86202 08183000
  1607.          ST    8,ASPKT       Ptr to buffer                     @SC86295 08189000
  1608.          MVC   0(1,8),SMARK  Add mark to packet                @SC86295 08190000
  1609.          TOCHR 9,,1(8)       Add it to packet                  @SC86295 08191000
  1610.          TOCHR 4,SEQ,2(8)    Get packet number                 @SC86295 08192000
  1611.          AR    9,4                   And add to checksum                08193000
  1612.          IC    3,STYPE               Type                               08194000
  1613.          STC   3,3(8)        Store in buffer                   @SC86295 08195000
  1614.          AR    9,3                   Add to checksum                    08196000
  1615.          CLI   1(8),ABL      Chk 'Type 0' extended hdr         @SC86295 08197000
  1616.          BNE   SPKNXDL3      No extended data len              @TB86196 08198000
  1617.          L     7,DATL        Data size                         @TB86196 08199000
  1618.          IC    3,BCTU        CHK len                           @TB86196 08200000
  1619.          AR    7,3           Sum = extended length             @TB86196 08201000
  1620.          SR    6,6                                             @TB86196 08202000
  1621.          D     6,XLFCT       Get two parts                     @TB86196 08203000
  1622.          TOCHR 7,,4(8)       Add LENX1 to packet               @SC86295 08204000
  1623.          AR    9,7           And add to checksum               @TB86196 08205000
  1624.          TOCHR 6,,5(8)       Add LENX2 to packet               @SC86295 08206000
  1625.          AR    9,6           And add to checksum               @TB86196 08207000
  1626.          LR    6,9           Chksum thru LENX2 byte            @TB86196 08208000
  1627.          SRL   6,6           High 2 bits of total              @TB86196 08209000
  1628.          N     6,F3          Get just 2 bits                   @SC86295 08210000
  1629.          AR    6,9           Get type-1 check value            @TB86196 08211000
  1630.          N     6,MOD64                                         @TB86196 08212000
  1631.          TOCHR 6,,6(8)       Make printable                    @SC86295 08213000
  1632.          AR    9,6           And add to checksum               @TB86196 08214000
  1633. SPKNXDL3 DS    0H                                              @TB86196 08215000
  1634.          L     8,ASDATA                                        @SC86295 08216000
  1635.          BCTR  8,0           Ptr one before data               @SC86295 08217000
  1636.          ICM   6,B'1111',DATL        Data length                        08218000
  1637.          BZ    SPKCHK                Go if no data                      08219000
  1638.          LR    5,6                                             @SC86135 08220000
  1639. SPKCHAR  IC    3,0(5,8)      Pick up char                      @SC86295 08221000
  1640.          AR    9,3                   Add to checksum                    08222000
  1641.          BCT   5,SPKCHAR     Yes, there's more data            @SC86135 08223000
  1642. SPKCHK   LA    6,1(6,8)      Point to where chksum goes        @SC86295 08224000
  1643.          LR    7,9                   Need copy of chksum                08225000
  1644.          CLI   BCTU,2                                                   08226000
  1645.          BE    SPKCHK2               Go if 2 char chksum                08227000
  1646.          BH    SPKCHK3               Go if 3 char CRC                   08228000
  1647.          SRL   9,6                   High 2 bits of total               08229000
  1648.          N     9,F3          Get just 2 bits                   @SC86295 08230000
  1649.          AR    7,9                   Add the two values                 08231000
  1650.          B     SPKCHK1               Go add chksum to data              08232000
  1651. *                                                                       08233000
  1652. SPKCHK3  L     5,ASPKT                                         @SC86190 08234000
  1653.          LA    5,1(5)        Where checksum starts             @SC86190 08235000
  1654.          KCALL CRCCLC        Calculate the CRC                          08236000
  1655.          LR    7,15                  Keep in here                       08237000
  1656.          SRL   15,12                 High 4 bits of high byte           08238000
  1657.          TOCHR 15,,0(6)              Make char printable                08239000
  1658.          LA    6,1(6)                Bump output pointer                08240000
  1659. SPKCHK2  LR    15,7                  total                              08241000
  1660.          SRL   15,6          Next 6 bits of total              @SC86295 08242000
  1661.          N     15,MOD64      Get just 6 bits                   @SC86295 08243000
  1662.          TOCHR 15,,0(6)              Make char printable                08244000
  1663.          LA    6,1(6)                Bump pointer                       08245000
  1664. SPKCHK1  N     7,MOD64               Get low order 6 bits               08246000
  1665.          TOCHR 7,,0(6)               Make printable                     08247000
  1666. SPKEOL   MVC   1(2,6),S1EOL  Add micro's EOL char + handshake  @SC87274 08248000
  1667.          KCALL SIO           Write the SNDPKT                  @SC86135 08249000
  1668.          RET   ,             Return with SIO's rc              @SC86295 08250000
  1669.          LOCALS ,                                              @SC86295 08251000
  1670. SPACK    EXIT                                                           08252000
  1671.          TITLE 'RPACK Routine - Reads data into DATA buffer'            08253000
  1672. * ERRNUM set if error found, unchanged otherwise               @SC89219 08253500
  1673. RPACK    ENTER                                                          08254000
  1674.          KCALL RIO,E=RPKNAK                                             08255000
  1675.          L     7,RCVPKL              Length of data read                08256000
  1676.          LM    14,15,TINTOT  Update recv count                 @SC86295 08257000
  1677.          ALR   15,7                                            @SC86295 08258000
  1678.          BC    12,*+8                                          @SC88092 08259000
  1679.          AL    14,F1                                           @SC86295 08260000
  1680.          STM   14,15,TINTOT  Save new count                    @SC86295 08261000
  1681.          L     8,APKT        Point to PKT                      @SC86190 08263000
  1682.          MVI   RTYPE,AT      In case of time-out               @SC87012 08264000
  1683.          C     7,F1          Time-out signal is ASCII T        @SC87012 08265000
  1684.          BNE   *+12                                            @SC87012 08266000
  1685.          CLI   0(8),AT                                         @SC87012 08267000
  1686.          BE    RTRN          Yes, timed out                    @SC87012 08268000
  1687.          AR    7,8           Point past last char                       08269000
  1688.          MVI   RPKERN,ERRSOH No start-of-packet found          @SC89219 08269500
  1689. RPKBEG   SR    3,3                   Use this for IC's                  08270000
  1690.          L     14,ARPKT      Point to recv buffer              @SC89065 08270500
  1691. RPKLOOP  CLC   RMARK,0(8)                                               08271000
  1692.          LA    8,1(8)        Try next character                @SC86135 08272000
  1693.          BE    RPKSOH                Go if a Control-A                  08273000
  1694.          CR    8,7                   Are we within the received pkt?    08274000
  1695.          BL    RPKLOOP               Yes, keep on looking for SOH       08275000
  1696.          B     RPKERR                                          @SC89219 08276000
  1697. *                                                                       08277000
  1698. RPKSOH   LA    9,4(14)       Skip over usual header            @SC86295 08278000
  1699.          MVC   1(3,14),0(8)  Copy usual header to RCVPKT       @SC86295 08279000
  1700.          MVI   RPKERN,ERRBPC SOH found - cksm may be bad       @SC89219 08279500
  1701.          UNCHR 3,0(8)                Length                             08280000
  1702.          BM    RPKBEG        Invalid length, try again         @SC86153 08281000
  1703.          LA    5,ABL(3)              Chksum accumulator                 08282000
  1704.          LR    4,3                   Keep length to compute DATA len    08283000
  1705.          LA    15,0(3,8)             pkt len + beg                      08284000
  1706.          CR    15,7                  Is it within received pkt?         08285000
  1707.          BNL   RPKBEG                too long, look for another SOH     08286000
  1708.          IC    3,2(8)        Pick up packet type               @SC86153 08287000
  1709.          STC   3,RTYPE       Save value here                   @SC86153 08288000
  1710.          NI    RTYPE,X'7F'   Assure conventional ASCII char    @SC88074 08288500
  1711.          AR    5,3           Add to checksum                   @SC86153 08289000
  1712.          BCTR  4,0                   -1 for Seq #                       08290000
  1713.          BCTR  4,0                   -1 for Type                        08291000
  1714.          UNCHR 3,1(8)        Pick up packet number             @SC86153 08292000
  1715.          BM    RPKBEG        Invalid char                      @SC86153 08293000
  1716.          LA    5,ABL(3,5)            Add to checksum                    08294000
  1717.          STC   3,RSN         Received packet number            @SC86135 08295000
  1718.          LA    8,3(8)        Go to putative data               @SC86153 08296000
  1719.          CLI   1(14),ABL     Is this an extended pkt?          @SC86295 08297000
  1720.          BNE   RPKEXT2       No                                @TB86196 08298000
  1721.          LA    15,3(8)       Past LENX1,LENX2,HCHECK           @TB86196 08299000
  1722.          CR    15,7          Is it within rcvd pkt?            @TB86196 08300000
  1723.          BNL   RPKBEG        Too long, try for another SOH     @TB86196 08301000
  1724.          MVC   4(3,14),0(8)  Copy extended pkt hdr             @SC86295 08302000
  1725.          UNCHR 1,0(8)        Pick up LENX1 byte                @TB86196 08303000
  1726.          LA    5,ABL(1,5)    Add to check                      @SC86202 08304000
  1727.          MH    1,XLFCT+2     High digit of size                @SC86202 08305000
  1728.          UNCHR 3,1(8)        Pick up LENX2 byte                @TB86196 08306000
  1729.          LA    5,ABL(3,5)    Add to chksum                     @SC86202 08307000
  1730.          AR    1,3           Total extended pkt size           @TB86196 08308000
  1731.          UNCHR 3,2(8)        Pick up HCHECK byte               @TB86196 08309000
  1732.          LR    6,5           Keep chksum copy here             @TB86196 08310000
  1733.          SRL   6,6           High 2 bits of total              @TB86196 08311000
  1734.          N     6,F3          Get just 2 bits                   @SC86295 08312000
  1735.          AR    6,5           Add the two values                @TB86196 08313000
  1736.          N     6,MOD64       Get low order 6 bits              @TB86196 08314000
  1737.          CR    6,3           Chk computed vs received          @TB86196 08315000
  1738.          BNE   RPKBEG        Err if chksums mismatch           @SC89219 08316000
  1739.          LA    5,ABL(3,5)    Add HCHECK to chksum              @SC86202 08317000
  1740.          LA    8,3(8)        Update input+output ptrs          @SC86202 08318000
  1741.          LA    9,3(9)        Past LX1,LX2,HCHECK               @SC86202 08319000
  1742.          LR    4,1           Save length of data+check         @SC86202 08320000
  1743.          AR    1,8           Expected end of packet            @SC86202 08321000
  1744.          CR    1,7           Is it within pkt?                 @SC86202 08322000
  1745.          BH    RPKBEG        Too long, chk for SOH             @SC86202 08323000
  1746. RPKEXT2  DS    0H                                              @SC86202 08324000
  1747.          IC    3,BCTU        Chksum length                     @SC86202 08325000
  1748.          SR    4,3           Minus chksum length               @SC86202 08326000
  1749.          BM    RPKBEG        Can't have negative data length   @SC86202 08327000
  1750.          ST    4,DATL        Save data length                  @SC86202 08328000
  1751.          ST    9,ARDATA      Save ptr                          @SC86202 08329000
  1752.          LTR   4,4           Any data received?                @SC89219 08330000
  1753.          BZ    RPKCHK                Nope                               08331000
  1754. RPKCHAR  IC    3,0(8)                Get next data char                 08332000
  1755.          STC   3,0(9)                Move it to DATA                    08333000
  1756.          AR    5,3                   Add to checksum                    08334000
  1757.          CLC   RMARK,0(8)                                      @SC89219 08334300
  1758.          BE    RPKBEG        Found another mark, start over    @SC89219 08334600
  1759.          LA    8,1(8)                Bump input buffer pointer          08335000
  1760.          LA    9,1(9)                Bump output buffer pointer         08336000
  1761.          BCT   4,RPKCHAR             Decrement amount of input          08337000
  1762. RPKCHK   UNCHR 3,0(8)                Get checksum                       08338000
  1763.          LR    6,9           CRC calc ends here                @SC86135 08339000
  1764.          CLC   RMARK,0(8)                                      @SC89065 08339300
  1765.          BE    RPKBEG        Found another mark, start over    @SC89065 08339600
  1766.          LA    8,1(8)                Bump input pointer                 08340000
  1767.          LR    4,5                   Keep chksum copy here              08341000
  1768.          CLI   BCTU,2                                                   08342000
  1769.          BE    RPKCHK2               Go if using 2 char chksum          08343000
  1770.          BH    RPKCHK3               Three character CRC                08344000
  1771.          SRL   5,6                   High 2 bits of total               08345000
  1772.          N     5,F3          Get just 2 bits                   @SC86295 08346000
  1773.          AR    4,5                   Add the two values                 08347000
  1774.          B     RPKCHK1               compare it                         08348000
  1775. *                                                                       08349000
  1776. RPKCHK3  LA    5,1(14)       Start of data for CRC             @SC86295 08350000
  1777.          KCALL CRCCLC        Calculate the CRC                          08351000
  1778.          LR    4,15                  Keep computed value here also      08352000
  1779.          SRL   15,12                 High 4 bits of high byte           08353000
  1780.          CR    15,3                  compare computed and received      08354000
  1781.          BNE   RPKBEG        Skip if chksums don't match       @SC89219 08355000
  1782.          UNCHR 3,0(8)                Get next char of checksum          08356000
  1783.          LA    8,1(8)                Bump input pointer                 08357000
  1784. RPKCHK2  LR    15,4                  Get back the CRC                   08358000
  1785.          SRL   15,6          Next 6 bits of total              @SC86295 08359000
  1786.          N     15,MOD64      Get just 6 bits                   @SC86295 08360000
  1787.          CR    15,3                  compare computed and received      08361000
  1788.          BNE   RPKBEG        Skip if chksums don't match       @SC89219 08362000
  1789.          UNCHR 3,0(8)                Get checksum                       08363000
  1790.          LA    8,1(8)                Bump input pointer                 08364000
  1791. RPKCHK1  N     4,MOD64               Get low order 6 bits               08365000
  1792.          CR    4,3                   Compare computed and received      08366000
  1793.          BE    RPKRET                skip if chksums match              08367000
  1794.          TM    FL1,TSTF                                        @SC86295 08368000
  1795.          BO    RPKRET        Just testing, anything goes       @SC86295 08369000
  1796.          CR    8,7                                             @BS86001 08371000
  1797.          BL    RPKBEG        More stuff, see if it's a packet  @BS86001 08372000
  1798. RPKERR   DS    0H                                              @SC89219 08372020
  1799.          L     8,APKT        Ptr to packet                     @SC88074 08372040
  1800.          MVC   STOPBUF,0(8)  Copy to work area                 @SC88074 08372080
  1801.          LA    8,STOPBUF                                       @SC88074 08372120
  1802.          L     7,RCVPKL                                        @SC88074 08372160
  1803.          AR    7,8           Ptr to packet end in work area    @SC88074 08372200
  1804.          CLC   RMARK,0(8)                                      @SC88074 08372240
  1805.          BE    RPKNAK        Assume bad packet if SOH present  @SC88074 08372280
  1806.          BCTR  7,0                                             @SC88074 08372320
  1807.          CLC   REOL,0(7)                                       @SC88074 08372360
  1808.          BNE   *+6                                             @SC88074 08372400
  1809.           BCTR 7,0           Don't count closing EOL           @SC88074 08372440
  1810.          TR    STOPBUF,ATOED                                   @SC89301 08372480
  1811.          TR    STOPBUF,UPCASE                                  @SC88074 08372520
  1812.          CLI   0(8),C'S'                                       @SC88074 08372560
  1813.          BE    *+8                                             @SC88074 08372600
  1814.           LA   8,1(8)        Allow one extra character in front@SC88074 08372640
  1815.          S     7,F3          Back len(STOP) - 1                @SC88074 08372680
  1816.          CR    7,8                                             @SC88074 08372720
  1817.          BNE   RPKNAK        Doesn't match exactly             @SC88074 08372760
  1818.          CLC   =C'STOP',0(8)                                   @SC88074 08372800
  1819.          BE    RPKSTP        Exact match                       @SC88074 08372840
  1820. RPKNAK   MVI   RTYPE,AQ              Return a Q pkt                     08373000
  1821. RPKRET   RET                                                            08374000
  1822. *                                                              @SC88074 08374100
  1823. RPKSTP   OI    FL3,ZPRO      Indicate stopping protocol mode   @SC88074 08374200
  1824.          MVI   ERRNUM,ERRTRC Transfer cancelled, if any        @SC88074 08374300
  1825.          MVI   RTYPE,X'FF'   Special packet type for quitting  @SC88074 08374400
  1826.          RET                                                   @SC88074 08374500
  1827.          LOCALS ,                                              @SC86295 08375000
  1828. STOPBUF  DS    CL8           Work area                         @SC88074 08375100
  1829. RPACK    EXIT                                                           08376000
  1830.          TITLE 'CRCCLC Routine - calculates CRC'                        08377000
  1831. * Calculate the CRC and return it in R15.  Expects R5 to point to the   08378000
  1832. * start of the data on which the CRC is calculated, and R6 to the       08379000
  1833. * char after the last one.                                              08380000
  1834. *                                                                       08381000
  1835. CRCCLC   ENTER                                                          08382000
  1836.          SR    15,15                 Initial CRC value is zero          08383000
  1837. CRCLUP   IC    4,0(5)        Get the next character            @SC86295 08384000
  1838.          XR    4,15          XOR char and CRC low byte         @SC86295 08385000
  1839.          LR    7,4                   same as above                      08386000
  1840.          SRL   7,4                   High 4 bits of low byte            08387000
  1841.          N     4,F                   Low 4 bits of low byte             08388000
  1842.          N     7,F           High 4 bits of low byte           @SC86295 08389000
  1843.          ALR   4,4                   Double to get index into table     08390000
  1844.          LH    4,CRCTAB2(4)          CRC for low 4 bits                 08391000
  1845.          ALR   7,7                   Double to get another index        08392000
  1846.          LH    7,CRCTAB1(7)          CRC for high 4 bits                08393000
  1847.          XR    4,7                   XOR the two                        08394000
  1848.          SRL   15,8                  Shift prev CRC 8 bits to right     08395000
  1849.          XR    15,4                  XOR current char's CRC into it     08396000
  1850.          N     15,=XL4'FFFF' Drop negative stuff               @SC86295 08397000
  1851.          LA    5,1(5)                Bump input pointer                 08398000
  1852.          CR    5,6                   Did we reach the end?              08399000
  1853.          BL    CRCLUP                Nope, loop for whole pkt           08400000
  1854. CRCRET   RET                                                            08401000
  1855. * Table to use for CRC calculation                                      08402000
  1856. CRCTAB1  HTBL  00,00,10,81,21,02,31,83,42,04,52,85,63,06,73,87 @SC89268 08403000
  1857.          HTBL  84,08,94,89,A5,0A,B5,8B,C6,0C,D6,8D,E7,0E,F7,8F @SC89268 08404000
  1858. *                                                                       08405000
  1859. CRCTAB2  HTBL  00,00,11,89,23,12,32,9B,46,24,57,AD,65,36,74,BF @SC89268 08406000
  1860.          HTBL  8C,48,9D,C1,AF,5A,BE,D3,CA,6C,DB,E5,E9,7E,F8,F7 @SC89268 08407000
  1861. *                                                                       08408000
  1862.          LOCALS ,                                              @SC86295 08409000
  1863. CRCCLC   EXIT                                                           08410000
  1864.          TITLE 'RIO Routine - Read packet into RCVPKT'                  08411000
  1865. RIO      ENTER                                                          08412000
  1866.          MVI   SIORIO,C'R'   Set type                          @SC86316 08413000
  1867.          L     7,APKT        Ptr to data                       @SC86316 08414000
  1868.          L     15,RIOC       Previous read count               @SC86295 08415000
  1869.          MVI   RIOC,X'80'    Nothing left in read buffer       @SC86295 08416000
  1870.          CLI   TRMTP,C'T'                                      @SC87166 08417000
  1871.          BE    RIOTTY        Go if not a S/1?                  @SC87166 08418000
  1872.          CLI   TRMTP,C'V'                                      @SC88323 08418300
  1873.          BE    RIOTTY        Go if VTAM TTY                    @SC88323 08418600
  1874.          LA    5,OFF80       Turn off all X'80' bits           @SC86316 08421000
  1875.          TM    RPRTY,DAT8    Unless 8-bit line                 @SC88288 08422000
  1876.          BZ    *+6           Not 8-bit                         @SC86316 08423000
  1877.          SR    5,5           Yes, use all bits                 @SC86316 08424000
  1878.          LTR   15,15         Any previous?                     @SC86295 08425000
  1879.          BNM   RIOCOM        Yes, use it                       @SC86295 08426000
  1880.          CLI   TRMTP,C'G'                                      @SC87215 08427000
  1881.          BE    RIOS1R        Skip prompt if graphics mode      @SC87215 08428000
  1882.          LA    0,4           Write                             @SC86295 08429000
  1883.          KCALL SCRNIO,S1XOPL,E=(RIOER,M) Send a prompt         @SC86295 08430000
  1884. RIOS1R   DS    0H                                              @SC87215 08431000
  1885.          LA    0,5           Read                              @SC86295 08432000
  1886.          KCALL SCRNIO,S1RDPL,E=(RIOER,M) perform read          @SC86295 08433000
  1887.          BP    RIOCOM                                          @SC86355 08434000
  1888. RIOER    MVI   ERRNUM,ERRTIE Terminal I/O error                @SC86156 08435000
  1889.          B     RTRN1         Error, return to caller           @SC86295 08436000
  1890. *                                                                       08437000
  1891. RIOTTY   LA    5,ETOA        Translate to ASCII                @SC86316 08438000
  1892.          TM    FL4,TTAB      Using separate terminal tables?   @SC87117 08439000
  1893.          BZ    *+8           No                                @SC87117 08440000
  1894.          LA    5,TETOA       Yes                               @SC87117 08441000
  1895.          ICM   6,15,KSYSETOA Possible overriding table         @SC88302 08441100
  1896.          BZ    *+6                                             @SC88302 08441200
  1897.          LR    5,6           Use it instead                    @SC88302 08441300
  1898.          LTR   15,15         Any previous data?                @SC86295 08442000
  1899.          BNM   RIOCOM        Yes, use it                       @SC86295 08443000
  1900.          LA    0,5           No, read some now                 @SC86295 08444000
  1901.          KCALL TERMIO,TYRDPL,E=(RIOER,M)                       @SC86295 08445000
  1902. RIOCOM   LR    6,15          Copy byte count                   @SC86295 08446000
  1903.          ST    6,RCVPKL      Save                                       08447000
  1904.          BAL   9,RIORAW      Log raw data                      @SC86316 08448000
  1905.          LR    2,7                                             @SC86316 08449000
  1906.          LR    3,6           Length                            @SC86202 08450000
  1907.          LTR   15,5          Copy table ptr                    @SC86316 08451000
  1908.          BZ    *+8           Don't translate after all         @SC86316 08452000
  1909.          BAL   14,TRANSLAT   Do the translate                  @SC86202 08453000
  1910.          BAL   9,RIOLOG      Write to log                      @SC86190 08454000
  1911.          B     RTRN0                                           @SC86295 08455000
  1912. *  Write record to log buffer, R7->data, R6=length             @SC87286 08456000
  1913. *  Clobbers R0,R1,R2,R3,R8,R14,R15, return to (R9)             @SC87286 08457000
  1914. RIORAW   SR    3,3           Write raw data                    @SC86316 08458000
  1915.          B     RIOLG1                                          @SC86316 08459000
  1916. RIOLOG   LA    3,ATOE        Write data in EBCDIC              @SC86316 08460000
  1917. RIOLG1   SR    8,8           Assume raw not wanted             @SC88168 08461000
  1918.          TM    DBGFLG,DBGRW                                    @SC88168 08461100
  1919.          BO    *+8                                             @SC88168 08461200
  1920.          LA    8,ATOE        Raw wanted                        @SC88168 08461300
  1921.          CR    3,8           Correct type (raw/EBCDIC)?        @SC88168 08461400
  1922.          BNER  9             No, skip this one                 @SC86316 08462000
  1923.          TM    FL1,DEBUG                                       @SC86316 08463000
  1924.          BZR   9             Skip if no debugging              @SC86190 08464000
  1925.          LA    8,2(6)        Two extra for R:, etc.            @SC87286 08465000
  1926.          L     2,LOGBUF      LOG buffer                        @SC86316 08466000
  1927.          MVC   0(1,2),SIORIO Indicate log type                 @SC86316 08467000
  1928.          LA    2,2(2)        Skip over prefix                  @SC86190 08468000
  1929.          LR    0,2           Buffer ptr                        @SC86190 08469000
  1930.          LR    1,8           Data length                       @SC86316 08470000
  1931.          LR    14,7          Data ptr                          @SC86316 08471000
  1932.          LR    15,8                                            @SC86316 08472000
  1933.          MVCL  0,14          Copy to log buffer                @SC86316 08473000
  1934.          LTR   15,3          Check if translation needed       @SC86316 08474000
  1935.          BZ    *+10          No                                @SC86316 08475000
  1936.          LR    3,8           Data length                       @SC86316 08476000
  1937.          BAL   14,TRANSLAT   Do the translate                  @SC86202 08477000
  1938.          WRITF LOGPTR,BSIZE=(8),E=RIOLQU                       @SC87034 08478000
  1939.          TM    DBGFLG,DBGSV  SAVE requested?                   @SC88168 08478300
  1940.          BZR   9             No, skip closing log file         @SC88168 08478600
  1941.          SAVEF LOGPTR        Update disk directory             @SC88168 08478900
  1942.          BR    9             Done                              @SC86190 08479000
  1943. RIOLQU   CLOSF LOGPTR        Turn off DEBUG, it fails          @SC86355 08480000
  1944.          NI    FL1,255-DEBUG                                   @SC86355 08481000
  1945.          BR    9                                               @SC86355 08482000
  1946.          TITLE 'SIO Routine - Send packet in SNDPKT'                    08483000
  1947. SIO      ENTER ALT                                             @SC86190 08484000
  1948.          MVI   SIORIO,C'S'   Set type                          @SC86316 08485000
  1949.          MVI   RTYPE,0       Clear previous received packet    @SC88074 08485500
  1950.          MVI   RIOC,X'80'    Set no read count                 @SC86295 08486000
  1951.          L     6,SNDPKL              Length of SNDPKT to be sent        08487000
  1952.          TM    FL4,NPS       Non-protocol?                     @SC86239 08488000
  1953.          BO    SIOPLEN       Yes, no handshake at all          @LP87272 08489000
  1954.          CLI   WRRD,0        Only writing?                     @LP87272 08490000
  1955. *        BE    SIOPLEN       Yes, handshake done next Read     @LP87272 08491000
  1956.          CLI   S1HND,0       Handshake desired at all?         @SC87275 08492000
  1957.          BE    SIOPLEN       No, skip it                       @SC87275 08493000
  1958.          LA    6,1(6)        Allow for handshake character     @LP87272 08494000
  1959. SIOPLEN  DS    0H                                              @SC86239 08495000
  1960.          L     7,ASPKT       Ptr to send data                  @SC86316 08496000
  1961.          BAL   9,RIOLOG      Write to log                      @SC86190 08497000
  1962.          L     2,S1WRPL      Final output buffer               @SC86154 08498000
  1963.          LR    1,2           Save start                        @SC86154 08499000
  1964.          SR    3,3                                             @SC86154 08500000
  1965.          TM    FL4,NPS       Non-protocol?                     @SC86191 08501000
  1966.          BO    *+8           Yes, skip padding                 @SC86191 08502000
  1967.          IC    3,SPADN       Pad count                         @SC86154 08503000
  1968.          LA    4,S1DATA                                        @SC86154 08504000
  1969.          LA    5,S1ORDL      Length of Series/1 stuff          @SC86154 08505000
  1970.          CLI   TRMTP,C'G'    Graphics?                         @SC87215 08506000
  1971.          BNE   SIOPAD                                          @SC87215 08507000
  1972.          LA    4,GRDATA      Yes, use separate command         @SC87215 08508000
  1973.          LA    5,GRDL                                          @SC87215 08509000
  1974. SIOPAD   DS    0H                                              @SC87215 08510000
  1975.          AR    3,5           Total padding + Series/1          @SC86154 08511000
  1976.          LA    9,0(5,2)      Save start of ASCII stuff         @SC88288 08511500
  1977.          ICM   5,8,SPADC     Get padding character             @SC86154 08512000
  1978.          MVCL  2,4           Copy to buffer with padding       @SC86154 08513000
  1979.          LR    3,6           Packet length                     @SC86154 08514000
  1980.          LR    5,6                                             @SC86154 08515000
  1981.          LR    4,7           Ptr to packet                     @SC86316 08516000
  1982.          MVCL  2,4           Copy packet to buffer             @SC86154 08517000
  1983.          CLI   TRMTP,C'T'                                      @SC87166 08518000
  1984.          BE    SIOTTY        Go if not S/1?                    @SC87166 08519000
  1985.          CLI   TRMTP,C'V'                                      @SC88323 08519300
  1986.          BE    SIOTTY        Go if VTAM TTY                    @SC88323 08519600
  1987.          LR    3,2           Copy end of transmission          @SC88288 08521500
  1988.          SR    2,1           Total length                      @SC86154 08522000
  1989.          ST    2,S1WRPL+4    Store len in CCW                  @SC86154 08523000
  1990.          LR    2,9           Start of ASCII stuff              @SC88288 08523100
  1991.          SR    3,2           Length                            @SC88288 08523200
  1992.          LA    15,ON80       Set high bits                     @SC88288 08523300
  1993.          TM    SPRTY,DAT8    Unless 8-bit line                 @SC88288 08523400
  1994.          BO    *+8           Yes, 8-bit downloading            @SC88288 08523500
  1995.           BAL  14,TRANSLAT                                     @SC88288 08523600
  1996.          L     4,=A(SCRNIO)  I/O routine for fullscreen        @SC89215 08524000
  1997.          LA    5,S1WRPL      1st plist                         @SC87275 08525000
  1998. SIOGO    LM    7,8,0(5)                                        @SC87275 08526000
  1999.          LM    14,15,TOUTOT  Update send count                 @SC88006 08526100
  2000.          ALR   15,8                                            @SC88006 08526200
  2001.          BC    12,*+8                                          @SC88092 08526300
  2002.          AL    14,F1                                           @SC88006 08526400
  2003.          STM   14,15,TOUTOT  Save new count                    @SC88006 08526500
  2004.          LR    6,8           Set up for log routine            @SC88168 08526700
  2005.          BAL   9,RIORAW      Log it                            @SC86316 08527000
  2006.          NI    FL5,255-NAK0  Something sent now                @SC90037 08527500
  2007.          LA    0,4           Write                             @SC86295 08528000
  2008.          KCALL (4),(5),E=(RIOER,M)                             @SC87275 08529000
  2009.          CLI   TRMTP,C'G'                                      @SC87215 08530000
  2010.          BE    SIOGOOD       No immediate answer if graphics   @SC87215 08531000
  2011.          LA    0,5                                             @SC86295 08532000
  2012.          KCALL (4),8(5),E=(RIOER,M) Read it now                @SC87275 08533000
  2013.          CLI   WRRD,0        Write/read?                       @SC86301 08534000
  2014.          BE    SIOGOOD       No, ignore bare status            @SC86301 08535000
  2015.          LTR   15,15                                           @TB87009 08536000
  2016.          BP    SIOCOM                                          @TB87009 08537000
  2017.          CLI   TRMTP,C'T'                                      @SC87275 08538000
  2018.          BE    SIOCOM        No problem if TTY                 @SC87275 08539000
  2019.          CLI   TRMTP,C'V'                                      @SC88323 08539300
  2020.          BE    SIOCOM        No problem if TTY                 @SC88323 08539600
  2021. * If only 3 bytes (AID and cursor) come in, VTAM has caused    @TB87009 08542000
  2022. * the S/1 to discard its transparent data. Fill the screen and @TB87009 08543000
  2023. * read it back in protocol conversion mode to cause VTAM       @TB87009 08544000
  2024. * to put up a longer READ MODIFIED CCW at its next read.       @TB87009 08545000
  2025.          LA    0,6           Message (Leave Transparent Mode)  @TB87009 08546000
  2026.          KCALL SCRNIO,SIORTPL,E=(SIORTY,M)                     @TB87009 08547000
  2027.          LA    0,5                                             @TB87009 08548000
  2028.          KCALL SCRNIO,S1RDPL,E=(RIOER,M) Rdmod to prime VTAM.  @TB87009 08549000
  2029. SIORTY   SR    15,15         No data actually seen.            @TB87009 08550000
  2030. SIOCOM   DS    0H                                              @TB87009 08551000
  2031.          ST    15,RIOC               save residual byte count           08552000
  2032. SIOGOOD  DS    0H                                              @SC88100 08553000
  2033.          B     RTRN0                                           @SC86295 08554000
  2034. *                                                                       08555000
  2035. SIOTTY   L     1,TYWRPL      Skip S/1 stuff                    @SC86295 08556000
  2036.          SR    2,1           Length to write                   @SC86154 08557000
  2037.          ST    2,TYWRPL+4    Length                            @SC86295 08558000
  2038.          ICM   15,15,KSYSATOE Possible overriding table        @SC88302 08558300
  2039.          BNZ   SIOTRNT                                         @SC88302 08558600
  2040.          LA    15,ATOE       Send in EBCDIC                    @SC86202 08559000
  2041.          TM    FL4,TTAB      Using separate terminal tables?   @SC87117 08560000
  2042.          BZ    *+8           No                                @SC87117 08561000
  2043.          LA    15,TATOE      Yes                               @SC87117 08562000
  2044. SIOTRNT  DS    0H                                              @SC88302 08562500
  2045.          LR    3,2           Length                            @SC87281 08563000
  2046.          LR    2,1                                             @SC86202 08564000
  2047.          BAL   14,TRANSLAT   Do the translate                  @SC86202 08565000
  2048.          L     4,=A(TERMIO)  I/O routine for TTY               @SC89215 08566000
  2049.          LA    5,TYWRPL      1st plist                         @SC87275 08567000
  2050.          B     SIOGO         Now do it                         @SC87275 08568000
  2051. *                                                              @TB87009 08569000
  2052. SIORTPL  DC    A(SIOMSGXX,SIOMSL)                              @TB87009 08570000
  2053. * Greetings for ERROR mode                                     @TB87009 08571000
  2054. SIOMSGXX DC    X'&S1CMD',AL1(SBA),X'4040'                      @TB87009 08572000
  2055.          DC    C'S/1 VTAM Error Recovery '                     @TB87009 08573000
  2056.          DC    AL1(RTA),X'4040',C' '  Blanks to end of screen  @SC88139 08574000
  2057. SIOMSL   EQU   *-SIOMSGXX                                      @TB87009 08575000
  2058. * For setting high bits...                                     @SC88288 08575050
  2059. ON80     DC    X'808182838485868788898A8B8C8D8E8F'             @SC88288 08575100
  2060.          DC    X'909192939495969798999A9B9C9D9E9F'             @SC88288 08575150
  2061.          DC    X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'             @SC88288 08575200
  2062.          DC    X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'             @SC88288 08575250
  2063.          DC    X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'             @SC88288 08575300
  2064.          DC    X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'             @SC88288 08575350
  2065.          DC    X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'             @SC88288 08575400
  2066.          DC    X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'             @SC88288 08575450
  2067.          DC    X'808182838485868788898A8B8C8D8E8F'             @SC88288 08575500
  2068.          DC    X'909192939495969798999A9B9C9D9E9F'             @SC88288 08575550
  2069.          DC    X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'             @SC88288 08575600
  2070.          DC    X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'             @SC88288 08575650
  2071.          DC    X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'             @SC88288 08575700
  2072.          DC    X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'             @SC88288 08575750
  2073.          DC    X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'             @SC88288 08575800
  2074.          DC    X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'             @SC88288 08575850
  2075.          LOCALS ,                                              @SC86295 08576000
  2076. SIORIO   DS    C             Operation code                    @SC86316 08577000
  2077. SIO      EXIT                                                           08578000
  2078.          TITLE 'INTINI Routine - Initialize console for protocol'       08579000
  2079. * If R1 is 0, reset the traps unless in Server mode.                    08580000
  2080. * If R1 is positive, set up console traps for protocol:                 08581000
  2081. *  1 for SERVER, 2 for SEND, 3 for RECEIVE, 4 for short msg    @SC86184 08582000
  2082. * R15 = 0 on return if ok                                               08583000
  2083. *                                                                       08584000
  2084. INTINI   ENTER                                                          08585000
  2085.          MVI   WRRD,5        Reset w/r flag                    @SC86184 08586000
  2086.          TM    FL2,SRV                                                  08587000
  2087.          BO    INTINIR               Return if server running           08588000
  2088.          LTR   3,1           Call type: 0 or 1-5               @HF86232 08589000
  2089.          BZ    INTINICL              If R1 is 0 clear traps             08590000
  2090.          OI    FL2,PROTO     Line open for transfer            @SC86295 08591000
  2091.          MVI   RTYPE,AN      No packet received yet            @SC89263 08591500
  2092.          ICM   5,15,LCLDLY   No delay?                         @HF86232 08592000
  2093.          BNZ   INTINIDL                                        @HF86232 08593000
  2094.          LA    1,5           Yes, use no message               @HF86232 08594000
  2095. INTINIDL C     1,F5          No delay or non-protocol send?    @HF86232 08595000
  2096.          BE    INTINIMS      Yes                               @HF86232 08596000
  2097.          BCT   5,INTINIMS    Short delay?                      @HF86232 08597000
  2098.          LA    1,4           Yes, use short message anyway     @SC86184 08598000
  2099. INTINIMS SLL   1,3           8-byte indexing                   @HF86232 08599000
  2100.          LA    5,INTCCWSR-8(1)  Get ptr to correct CCW         @SC86184 08600000
  2101.          MVC   SVHND,S1HND   Save handshake character          @SC87343 08601000
  2102.          KCALL SETMSG,2,E=INTINERR Prepare line for transfer   @SC87300 08602000
  2103.          LA    0,2                                             @SC87309 08603000
  2104.          SR    0,3                                             @SC87309 08604000
  2105.          LPR   0,0           Get ABS(code-2)                   @SC87309 08605000
  2106.          BCT   0,*+8         Test for Serve or Rec codes (1,3) @SC87309 08606000
  2107.          OI    FL5,NAK0      Send NAK during retry, if any     @SC90037 08607000
  2108.          MVI   RIOC,X'80'    Clr any prev byte count           @SC86295 08608000
  2109.          CLI   TRMTP,C'T'                                      @SC87166 08609000
  2110.          BE    INTINITY      Go if TTY                         @SC87166 08610000
  2111.          CLI   TRMTP,C'V'                                      @SC88323 08610300
  2112.          BE    INTINITY      Go if TTY                         @SC88323 08610600
  2113.          LA    0,1           Open screen                       @SC86295 08613000
  2114.          KCALL SCRNIO                                          @SC86295 08614000
  2115.          LA    0,6           Simple write                      @SC86316 08615000
  2116.          KCALL SCRNIO,(5),E=(INTINIR,M)  Message               @SC86295 08616000
  2117.          C     3,F2          Was this SEND?                    @SC86184 08617000
  2118.          BE    INTINIR               SEND does sleep anyway             08618000
  2119.          ICM   0,15,LCLDLY   See if speed wanted               @SC87253 08619000
  2120.          BZ    INTINIP       Yes, no greetings anyway          @SC87309 08620000
  2121.          LA    0,1           Wait 1 sec                        @SC86295 08621000
  2122.          KCALL SUPFNC,9      This seems essential              @SC86295 08622000
  2123. INTINIP  CLI   TRMTP,C'G'    Graphics terminal?                @SC87309 08623000
  2124.          BNE   INTINIR       No, go ahead                      @SC87309 08624000
  2125.          TM    FL5,NAK0      Will we receive?                  @SC90037 08625000
  2126.          BZ    *+8           No, fine                          @SC87309 08626000
  2127.          BAL   2,SENDNAK     Yes, must prompt hardware         @SC87309 08627000
  2128.          B     INTINIR                                                  08628000
  2129. *                                                                       08629000
  2130. INTINITY L     1,0(5)        Text address from ccw             @SC86184 08630000
  2131.          LH    4,6(5)        Get total length                  @SC86184 08631000
  2132.          LA    3,INTPRL(1)   Skip over WCC and SBA             @SC86184 08632000
  2133.          SH    4,*-2          and deduct that from length      @SC86184 08633000
  2134.          C     4,F64                                           @SC86184 08634000
  2135.          BL    INTINIT2      Just one (short) line             @SC86184 08635000
  2136.          LA    4,80                  Length to type                     08636000
  2137.          WTEXT (3),(4)                                                  08637000
  2138.          LA    3,80(3)               Next line                          08638000
  2139. INTINIT2 WTEXT (3),(4)                                         @SC86184 08639000
  2140.          LA    0,1                                             @SC86295 08640000
  2141.          KCALL TERMIO        Open line                         @SC86295 08641000
  2142.          B     INTINIR                                                  08642000
  2143. *                                                                       08643000
  2144. INTINICL NI    FL3,255-ZPRO  Now stopping protocol mode        @SC88074 08644000
  2145.          TM    FL2,PROTO     Was line open?                    @SC88074 08644500
  2146.          BZ    INTINIR       No                                @SC86295 08645000
  2147.          LA    0,2                                             @SC86295 08646000
  2148.          L     15,=A(TERMIO)                                   @SC89215 08647000
  2149.          CLI   TRMTP,C'T'                                      @SC87300 08648000
  2150.          BE    INTINIK       Go if TTY                         @SC87300 08649000
  2151.          CLI   TRMTP,C'V'                                      @SC88323 08649300
  2152.          BE    INTINIK       Go if VTAM TTY                    @SC88323 08649600
  2153.          L     15,=A(SCRNIO)                                   @SC89215 08652000
  2154. INTINIK  KCALL (15)          Release line                      @SC87300 08653000
  2155.          KCALL SETMSG,3                                        @SC86316 08654000
  2156.          MVC   S1HND,SVHND   Restore handshake character       @SC87343 08655000
  2157.          NI    FL2,255-PROTO End protocol mode                 @SC88035 08655500
  2158. INTINIR  B     RTRN0                                           @SC87300 08656000
  2159. *                                                                       08657000
  2160. INTINERR NI    FL2,255-PROTO Turn off protocol mode            @SC87300 08658000
  2161.          MVI   ERRNUM,ERRCOM Bad comm line                     @SC87300 08659000
  2162.          B     RTRN1                                           @SC87300 08660000
  2163. *                                                                       08661000
  2164.          DS    0D                                                       08662000
  2165. INTCCWSR DC    A(INTMSGSR,INTPRL+80+80)                        @SC86295 08663000
  2166. INTCCWSN DC    A(INTMSGSN,INTPRL+80+80)                        @SC86295 08664000
  2167. INTCCWRC DC    A(INTMSGRC,INTPRL+80+80)                        @SC86295 08665000
  2168. INTCCWQU DC    A(INTMSGQU,INTQL)                               @SC86295 08666000
  2169. INTCCWNL DC    A(INTMSGQU,INTPRL)                              @SC86295 08667000
  2170. * Short greetings                                              @SC86184 08668000
  2171. INTMSGQU DC    X'&S1CMD',AL1(SBA),X'4040'                      @SC86295 08669000
  2172. INTPRL   EQU   *-INTMSGQU    Length of prefix                  @SC86295 08670000
  2173. INTMSGQ2 DC    C'Kermit-&KSYS....'                             @SC86268 08671000
  2174. INTQL    EQU   *-INTMSGQU                                      @SC86184 08672000
  2175. * Greetings for RECEIVE mode                                            08673000
  2176. INTMSGRC DC    X'&S1CMD',AL1(SBA),X'4040'                      @SC86295 08674000
  2177.  DC CL80'Kermit-&KSYS ready to receive.'                       @SC86268 08675000
  2178.  DC CL80'Please escape to local Kermit now to SEND the file(s).'        08676000
  2179. * Greetings for SEND mode                                               08677000
  2180. INTMSGSN DC    X'&S1CMD',AL1(SBA),X'4040'                      @SC86295 08678000
  2181.  DC CL80'Kermit-&KSYS ready to send.'                          @SC86268 08679000
  2182.  DC CL80'Please escape to local Kermit now to RECEIVE the file(s).'     08680000
  2183. * Greetings for SERVER mode                                             08681000
  2184. INTMSGSR DC    X'&S1CMD',AL1(SBA),X'4040'                      @SC86295 08682000
  2185.  DC CL80'Entering server mode.  Please escape to local Kermit now.'     08683000
  2186.  DC CL80'To terminate the server use the BYE or FINISH commands.'       08684000
  2187. *                                                                       08685000
  2188.          LOCALS ,                                              @SC86295 08686000
  2189. INTINI   EXIT                                                           08687000
  2190.          TITLE 'INBUF Routine - read next disk record into WBUF'        08688000
  2191. * Exit: R15=0 if ok, -1 if EOF, 1 if read error (ERRNUM set)            08689000
  2192. INBUF    ENTER                                                          08690000
  2193.          TM    FL1,EOF                                                  08691000
  2194.          BO    RTRNM1        Go if hit eof already             @SC86295 08692000
  2195.          SR    15,15         In case reading from memory       @SC86158 08693000
  2196.          ST    15,RBUFP      Clear read buffer pointer         @SC86158 08694000
  2197.          ST    15,RBUFL      Clear read buffer length          @SC86158 08695000
  2198.          L     9,RBUF        Read into this buffer             @SC86158 08696000
  2199.          TM    FL4,SFM       Source is memory?                 @SC86158 08697000
  2200.          BZ    IBFDSK        No, read disk                     @SC86158 08698000
  2201.          LM    4,5,TXTPTR    Yes, copy to buffer               @SC86158 08699000
  2202.          CR    4,5           Any left?                         @SC86158 08700000
  2203.          BNL   IBFEOF        No, quit                          @SC86158 08701000
  2204.          XC    CMD,CMD                                         @SC86158 08702000
  2205.          MVI   CMD+X'15',1   Set up TRT                        @SC86158 08703000
  2206.          MVC   0(256,9),0(4) Copy one line or so               @SC86158 08704000
  2207.          LA    1,256(4)      In case no NL                     @SC86158 08705000
  2208.          TRT   0(256,4),CMD  Scan for NL                       @SC86158 08706000
  2209.          CR    1,5           No X'15'?                         @SC86158 08707000
  2210.          BNH   *+6           OK                                @SC86158 08708000
  2211.          LR    1,5           Limit is end of data              @SC86158 08709000
  2212.          SR    1,4           Length of line                    @SC86158 08710000
  2213.          LA    4,1(1,4)                                        @SC86158 08711000
  2214.          ST    4,TXTPTR      Update ptr                        @SC86158 08712000
  2215.          LR    0,1           Save length                       @SC86158 08713000
  2216.          B     IBFXLAT       Go change to ASCII                @SC86158 08714000
  2217. IBFDSK   DS    0H                                              @SC86158 08715000
  2218.          ICM   1,15,FLNOPTS  Get record counter                @SC89218 08715100
  2219.          AL    1,F1                                            @SC89218 08715200
  2220.          STCM  1,15,FLNOPTS  Update record counter             @SC89218 08715300
  2221.          CLM   1,15,FLNOPTS+4 Passed end?                      @SC89218 08715400
  2222.          BH    IBFEOF        Yes, quit now                     @SC89218 08715500
  2223.          ICM   2,15,RDWLEN   Special format?                   @SC86151 08716000
  2224.          BZ    *+6           No                                @SC86151 08717000
  2225.          AR    9,2           Space over record descriptor      @SC86151 08718000
  2226.          READF FILPTR,BUFFER=(9),E=IBFERR                      @SC87034 08719000
  2227.          LM    14,15,DSKTOT  Update disk count                 @SC86295 08720000
  2228.          ALR   15,0                                            @SC86295 08721000
  2229.          BC    12,*+8                                          @SC88092 08722000
  2230.          AL    14,F1                                           @SC86295 08723000
  2231.          STM   14,15,DSKTOT  Save new count                    @SC86295 08724000
  2232.          LTR   2,2           Special format?                   @SC86151 08725000
  2233.          BZ    IBFNRM        No                                @SC86151 08726000
  2234.          SR    9,2           Back up to start of buffer        @SC86151 08727000
  2235.          STCM  0,3,0(9)      Store length                      @SC86151 08728000
  2236.          C     2,F2          Short?                            @SC86262 08729000
  2237.          BE    IBFVLEN       Yes                               @SC86262 08730000
  2238.          CVD   0,TMPDW       No, use 5-byte ASCII              @SC86262 08731000
  2239.          OI    TMPDW+7,15                                      @SC86262 08732000
  2240.          UNPK  0(5,9),TMPDW                                    @SC86262 08733000
  2241.          TR    0(5,9),ETOAD                                    @SC89301 08734000
  2242. IBFVLEN  DS    0H                                              @SC86262 08735000
  2243.          AR    0,2                                             @SC86151 08736000
  2244.          B     IBFLEN        Must be binary                    @SC86151 08737000
  2245. IBFNRM   DS    0H                                              @SC86151 08738000
  2246.          TM    FL1,BINF                                                 08739000
  2247.          BO    IBFLEN                No trans for binary file           08740000
  2248.          ICM   1,15,RMARG    Text file: check margins          @SC87253 08741000
  2249.          BZ    IBFCKLM       No right margin specified         @SC87253 08742000
  2250.          CR    0,1                                             @SC87253 08743000
  2251.          BNH   IBFCKLM       Record is shorter than margin     @SC87253 08744000
  2252.          LR    0,1           Truncate record at margin         @SC87253 08745000
  2253. IBFCKLM  L     1,LMARG                                         @SC87253 08746000
  2254.          S     1,F1                                            @SC87253 08747000
  2255.          BNP   IBFXLAT       No left margin, or start in col 1 @SC87253 08748000
  2256.          SR    0,1           See if record is long enough      @SC87253 08749000
  2257.          BNP   IBFEMPT       Too short, make empty record      @SC87253 08750000
  2258.          LR    2,9           Ptr to record                     @SC87253 08751000
  2259.          LR    3,0           Shortened length                  @SC87253 08752000
  2260.          LA    4,0(1,2)                                        @SC87253 08753000
  2261.          LR    5,3                                             @SC87253 08754000
  2262.          MVCL  2,4           Eliminate stuff before margin     @SC87253 08755000
  2263. IBFXLAT  LA    15,ETOA       Change to ASCII                   @SC86202 08756000
  2264.          LR    2,9           Address                           @SC86202 08757000
  2265.          LR    3,0           Length                            @SC86202 08758000
  2266.          BAL   14,TRANSLAT   Do the translate                  @SC86202 08759000
  2267.          AR    9,0           Point one past last char                   08760000
  2268.          C     0,F1                                            @SC88340 08760100
  2269.          BE    IBFTRUNC      Record of 1 blank always converted@SC88340 08760200
  2270.          CLI   FRECF,C'F'                                      @SC88050 08760300
  2271.          BE    IBFTRUNC      Always trim if fixed length       @SC88349 08760600
  2272.          CLC   RMARG,F0                                        @SC88349 08760700
  2273.          BE    IBFTRUZ       Don't trim if no fixed rt. margin @SC88349 08760800
  2274. IBFTRUNC BCTR  9,0                   Back up one                        08761000
  2275.          CLI   0(9),ABL                                                 08762000
  2276.          BNE   IBFLCHAR              Found non-blank                    08763000
  2277.          BCT   0,IBFTRUNC            FIND LAST CHAR                     08764000
  2278. IBFEMPT  SR    0,0           Record is empty                   @SC87253 08765000
  2279. IBFTRUZ  BCTR  9,0           Point to last char of record      @SC88050 08766000
  2280. IBFLCHAR MVI   1(9),CR       Add CR                            @SC86135 08767000
  2281.          MVI   2(9),ALF      Add LF                            @SC86135 08768000
  2282.          A     0,F2                  Two extra bytes of data            08769000
  2283. IBFLEN   ST    0,RBUFL               LRECL or LRECL + 2 (FOR CRLF)      08770000
  2284.          B     RTRN0                                                    08771000
  2285. *                                                                       08772000
  2286. IBFEOF   OI    FL1,EOF                                                  08773000
  2287.          B     RTRNM1                                          @SC86295 08774000
  2288. *                                                                       08775000
  2289. IBFERR   C     15,F12                EOF code?                          08776000
  2290.          BE    IBFEOF                Yes                                08777000
  2291.          ERRF  ,             Disk read error, analyze it       @SC87338 08778000
  2292.          CLOSF FILPTR        Close file                        @SC86295 08779000
  2293.          B     RTRN1                                           @SC86295 08780000
  2294.          LOCALS ,                                              @SC86295 08781000
  2295. INBUF    EXIT                                                           08782000
  2296.          TITLE 'OUTBUF Routine - write WBUF to a disk file'             08783000
  2297. * Entry: R1=length of buffer (which starts where WBUF points)           08783300
  2298. * Exit: R15=0 if ok, other if error (ERRNUM set)                        08783600
  2299. OUTBUF   ENTER                                                          08784000
  2300.          LR    9,1           Save buffer length                @SC88120 08785000
  2301.          L     6,FSIZE       Use to hold lrecl                 @SC88120 08786000
  2302.          L     7,WBUF                Address of buffer                  08788000
  2303.          ICM   2,15,RDWLEN                                     @SC86151 08789000
  2304.          BZ    OBFNRM                                          @SC86151 08790000
  2305.          SR    1,1           Special format                    @SC86151 08791000
  2306.          ICM   1,3,0(7)      Get true record length            @SC86151 08792000
  2307.          C     2,F2          Short?                            @SC86262 08793000
  2308.          BE    OBFVLEN       Yes                               @SC86262 08794000
  2309.          PACK  TMPDW,0(5,7)  No, must be 5-byte ASCII          @SC86262 08795000
  2310.          OI    TMPDW+7,15    Get + sign                        @SC86262 08796000
  2311.          CVB   1,TMPDW       Convert back to binary            @SC86262 08797000
  2312. OBFVLEN  DS    0H                                              @SC86262 08798000
  2313.          AR    7,2           Skip over descriptor              @SC86151 08799000
  2314.          SR    9,2           Correct length                    @SC86151 08800000
  2315.          LA    15,15         Suitable disk error               @SC86151 08803000
  2316.          CR    1,9           Match?                            @SC86151 08804000
  2317.          BE    OBFLEN        Ok, do it                         @SC88053 08805000
  2318.          L     1,FILPTR      Ptr to disk FAB                   @SC88053 08805500
  2319.          MVC   FABCOMM-FABD(8,1),=CL8'Binary'                  @SC88053 08806000
  2320.          B     OBFERR        No, give up                       @SC88053 08806500
  2321. OBFNRM   DS    0H                                              @SC86151 08807000
  2322.          TM    FL1,BINF                                                 08808000
  2323.          BO    OBFLEN                Go if binary data file             08809000
  2324.          LTR   9,9                   Any data to write?                 08810000
  2325.          BNZ   OBFTR                 Yes, there's data                  08811000
  2326.          MVI   0(7),ABL              Make first char a space            08812000
  2327.          LA    9,1                   Length of one                      08813000
  2328. OBFTR    LA    15,ATOE       Change to EBCDIC                  @SC86202 08814000
  2329.          LR    2,7                                             @SC86202 08815000
  2330.          LR    3,9           Length                            @SC86202 08816000
  2331.          BAL   14,TRANSLAT   Do the translate                  @SC86202 08817000
  2332. OBFLEN   CR    9,6           Compare data len. to trunc len.   @SC88120 08820000
  2333.          BE    OBFWRT        Go if lrecl exactly               @SC87268 08824000
  2334.          BH    OBFTRNC       Go if must truncate               @SC87268 08825000
  2335.          CLI   FRECF,C'F'                                      @SC88120 08825300
  2336.          BNE   OBFWRT        Go if variable format             @SC88120 08825600
  2337.          LR    1,6                   Else, get lrecl size               08826000
  2338.          SR    1,9                   Pad with this many spaces          08827000
  2339.          LA    0,0(9,7)              Where to start padding             08828000
  2340.          SR    15,15                                           @SC86295 08829000
  2341.          TM    FL1,BINF                                        @SC86295 08830000
  2342.          BO    *+8                                             @SC86295 08831000
  2343.          ICM   15,8,BLANK    Pad with spaces                   @SC86295 08832000
  2344.          MVCL  0,14                  Do it                              08833000
  2345.          B     OBFLRECL      And note new length               @SC87268 08834000
  2346. OBFTRNC  LA    0,1                                             @SC87268 08835000
  2347.          A     0,RECTRC                                        @SC87268 08836000
  2348.          ST    0,RECTRC      Increment count of truncations    @SC87268 08837000
  2349.          CLI   TRNCFL,C'H'   Do we halt here?                  @SC88120 08837200
  2350.          BNE   OBFLRECL      Truncation allowed, ok            @SC88120 08837400
  2351.          MVI   ERRNUM,ERRRTR Mark error and stop               @SC88120 08837600
  2352.          B     RTRN1                                           @SC88120 08837800
  2353. OBFLRECL LR    9,6                   Length has to be this size         08838000
  2354. OBFWRT   LM    14,15,DSKTOT  Update disk count                 @SC86295 08839000
  2355.          ALR   15,9                                            @SC86295 08840000
  2356.          BC    12,*+8                                          @SC88092 08841000
  2357.          AL    14,F1                                           @SC86295 08842000
  2358.          STM   14,15,DSKTOT  Save new count                    @SC86295 08843000
  2359.          WRITF FILPTR,BUFFER=(7),BSIZE=(9)                     @SC87034 08844000
  2360.          LTR   15,15                 Any disk write errors?             08845000
  2361.          BZ    OBFRET                Nope, all OK                       08846000
  2362.          MVI   ERRNUM,ERRFUL Maybe disk is full                @SC86345 08847000
  2363.          CLM   15,1,ERRNUM   Is it?                            @SC86345 08848000
  2364.          BE    OBFRET        Yes, too bad                      @SC86345 08849000
  2365. OBFERR   ERRF  ,             General write error, analyze it   @SC87338 08850000
  2366. OBFRET   RET                                                            08851000
  2367.          LOCALS ,                                              @SC86295 08852000
  2368. OUTBUF   EXIT                                                           08853000
  2369.          TITLE 'FOPSTR Routine - test string for file options'          08854000
  2370. * Entry: R1->Address of option field, R6->string, R7=length - 1         08855000
  2371. * Exit: R15=0 + R6,R7 fixed if ok, R15=1 if error (msg ptrs set up)     08856000
  2372. FOPSTR   ENTER ,                                               @SC89218 08857000
  2373.          LR    5,1           Save ptr to options               @SC89218 08858000
  2374.          NI    FL2,255-FOPTS Clear option flag                 @SC89218 08859000
  2375.          MVC   0(8,5),=F'0,-1' Default values                  @SC89218 08860000
  2376.          LA    9,0(7,6)      Point to last character           @SC89218 08861000
  2377.          LR    1,9                                             @SC89218 08862000
  2378.          EX    7,FOPTRT      Scan for option starter           @SC89218 08863000
  2379.          BZ    RTRN0         Not found, no action              @SC89218 08864000
  2380.          OI    FL2,FOPTS     Yes, note the fact                @SC89218 08865000
  2381.          PTEXT 'Option error: Missing option(s)'  Just in case @SC89249 08866000
  2382.          CR    1,9           Anything after the starter?       @SC89218 08867000
  2383.          BE    FOPERR        No, too bad                       @SC89218 08868000
  2384.          PTEXT 'Option error: Invalid final delimiter'  In case@SC89249 08869000
  2385.          CLI   0(9),FBRK2    Check ending                      @SC89218 08870000
  2386.          BNE   FOPERR        Wrong one                         @SC89218 08871000
  2387.          LR    0,1                                             @SC89218 08872000
  2388.          SR    0,6           Length of stuff before options    @SC89218 08873000
  2389.          BCTR  0,0           Length - 1                        @SC89218 08874000
  2390.          LA    6,1(,1)       Ptr to option string              @SC89218 08875000
  2391.          RETREG (7,0)        Return length-1 as fixed R7       @SC89218 08876000
  2392. *          Set up loop over line numbers                       @SC89218 08877000
  2393.          LA    1,2                                             @SC89218 08878000
  2394.          LR    2,5           Ptr to option fields              @SC89218 08879000
  2395.          LA    8,C'-'        Delimiter after 1st number        @SC89218 08880000
  2396. *                                                                       08881000
  2397. FOPNLP   LA    7,1(,9)       End of string                     @SC89218 08882000
  2398.          SR    7,6           Length remaining                  @SC89218 08883000
  2399.          CH    7,*+10                                          @SC89218 08884000
  2400.          BNH   *+8                                             @SC89218 08885000
  2401.          LA    7,15          Max allowed by GETNUM             @SC89218 08886000
  2402.          LR    15,6          Save start of string              @SC89218 08887000
  2403.          BAL   14,GETNUM     1st, returns R15->end of digits   @SC89218 08888000
  2404.          LR    7,15                                            @SC89218 08889000
  2405.          SR    7,6           Length of numeric string          @SC89218 08890000
  2406.          BAL   14,GETNUM     2nd, returns number and skips     @SC89218 08891000
  2407.           SR   0,0           Omitted, use -1                   @SC89218 08892000
  2408.           BCTR 0,0                                             @SC89218 08893000
  2409.          LA    6,1(,15)      Ptr to rest of string             @SC89218 08894000
  2410.          STCM  0,15,0(2)     Save result in option field       @SC89218 08895000
  2411.          CLI   0(15),FBRK2   Reached end?                      @SC89218 08896000
  2412.          BE    FOPNLQ        Yes, quit scanning                @SC89218 08897000
  2413.          CLI   0(15),C'_'    Reached end of range limits?      @SC89218 08898000
  2414.          BE    FOPNLQ        Yes, quit scanning                @SC89218 08899000
  2415.          PTEXT 'Option error: Invalid delimiter'               @SC89249 08900000
  2416.          CLM   8,1,0(15)     Delimiter for this number?        @SC89218 08901000
  2417.          BNE   FOPERR        None of these, syntax error       @SC89218 08902000
  2418.          LA    2,4(,2)       Advance output ptr                @SC89218 08903000
  2419.          LA    8,C'_'        Change delimiter                  @SC89218 08904000
  2420.          BCT   1,FOPNLP      Get next number                   @SC89218 08905000
  2421. FOPNLQ   ICM   1,15,0(5)     Check starting line number        @SC89218 08906000
  2422.          S     1,F1          Convert to number to skip         @SC89218 08907000
  2423.          BNM   *+6                                             @SC89218 08908000
  2424.           SR   1,1           No skipping                       @SC89218 08909000
  2425.          STCM  1,15,0(5)                                       @SC89218 08910000
  2426.          PTEXT 'Option error: Invalid line range'              @SC89249 08911000
  2427.          CLM   1,15,4(5)     Check range for order             @SC89218 08912000
  2428.          BNL   FOPERR        Upper limit smaller!              @SC89218 08913000
  2429.          CR    6,9           Any more option text?             @SC89218 08914000
  2430.          BNL   RTRN0         No, all done                      @SC89218 08915000
  2431. *          Other options                                       @SC89218 08916000
  2432. *                                                                       08917000
  2433. *                                                                       08918000
  2434. *          Nothing implemented                                 @SC89218 08919000
  2435. *                                                                       08920000
  2436. *          Fall through if option not defined                  @SC89218 08921000
  2437.          PTEXT 'Option error: Unknown file option(s)'          @SC89249 08922000
  2438. FOPERR   RETREG 3,4          Return msg ptrs as R3, R4         @SC89218 08923000
  2439.          MVI   ERRNUM,ERROPT Error with option(s)              @SC89249 08923500
  2440.          B     RTRN1                                           @SC89218 08924000
  2441. *                                                                       08925000
  2442. FOPTRT   TRT   0(,6),FOPBRK  Scan for initial character        @SC89218 08926000
  2443. FOPBRK   DC    256X'00'                                        @SC89218 08927000
  2444.          ORG   FOPBRK+FBRK1                                    @SC89218 08928000
  2445.          DC    X'01'                                           @SC89218 08929000
  2446.          ORG   ,                                               @SC89218 08930000
  2447.          LOCALS ,                                              @SC89218 08931000
  2448.          EXIT  ,                                               @SC89218 08932000
  2449.          END   KERMIT                                                   08933000
  2450.